# Path: pt_law_parser/auxiliar.py
# def eq(value1, value2, epsilon):
#     return abs(value1 - value2) < epsilon
# 
# def middle_x(bbox):
#     return (bbox[0] + bbox[2])/2.


import re
from collections import defaultdict
from pdfminer.layout import LTComponent, LTImage
from pt_law_parser.auxiliar import eq, middle_x

        def add(self, row, column):
            if self.row is None:
                self.row = row
                self.column = column
            else:
                if self.row == row:
                    self.colspan += 1
                if self.column == column:
                    self.rowspan += 1

        def add_line(self, item, bbox):
            """
            Adds a line to the cell assuming a bounding box bbox.
            """
            # todo: this code is similar to _parse_line. Common implementation?
            def remove_dots(text):
                return text.replace(' .', '')

            text = remove_dots(item.get_text())
            if text == '.':
                return
            line = Paragraph(text)

            if not self._lines:
                # cell is empty
                self._lines.append(line)
                self._min_x = item.x0
            else:
                middle_x_cell = middle_x(bbox)

# Path: pt_law_parser/auxiliar.py
# def eq(value1, value2, epsilon):
#     return abs(value1 - value2) < epsilon
# 
# def middle_x(bbox):
#     return (bbox[0] + bbox[2])/2.


# Path: pt_law_parser/html.py
import re
from collections import defaultdict
from pdfminer.layout import LTComponent, LTImage
from pt_law_parser.auxiliar import eq, middle_x


        def add(self, row, column):
            if self.row is None:
                self.row = row
                self.column = column
            else:
                if self.row == row:
                    self.colspan += 1
                if self.column == column:
                    self.rowspan += 1

        def add_line(self, item, bbox):
            """
            Adds a line to the cell assuming a bounding box bbox.
            """
            # todo: this code is similar to _parse_line. Common implementation?
            def remove_dots(text):
                return text.replace(' .', '')

            text = remove_dots(item.get_text())
            if text == '.':
                return
            line = Paragraph(text)

            if not self._lines:
                # cell is empty
                self._lines.append(line)
                self._min_x = item.x0
            else:
                middle_x_cell = middle_x(bbox)

                middle_x_line = middle_x(item.bbox)