diff --git a/.circleci/config.yml b/.circleci/config.yml index e647616e..37eb91a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,11 +2,11 @@ version: 2 jobs: build: machine: - image: ubuntu-2004:current + image: ubuntu-2204:2023.10.1 parallelism: 1 steps: - checkout - run: - docker-compose up + docker compose up - store_artifacts: path: docs/wip diff --git a/requirements.txt b/requirements.txt index 670be700..715f6c72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -docker-compose==1.29.2 pip==23.3.1 python-docx==1.1.0 python-pptx==0.6.23 diff --git a/src/builder/xlsx_builder.py b/src/builder/xlsx_builder.py index 7783f640..c8d73887 100644 --- a/src/builder/xlsx_builder.py +++ b/src/builder/xlsx_builder.py @@ -53,7 +53,7 @@ def start_element(self, tag: str, attributes: TreeBuilderAttributes) -> None: super().start_element(tag, attributes) if tag == xmltags.DOCUMENT: self.__create_checklist(str(attributes["version"])) - elif tag == xmltags.MEASURE and not self.in_element(xmltags.SECTION, {xmltags.SECTION_IS_APPENDIX: "y"}): + elif tag == xmltags.MEASURE and not self.__in_appendix(): if self.last_level_1_section_heading: self.row += 1 self.checklist.merge_range( @@ -77,9 +77,7 @@ def text(self, tag: str, text: str, attributes: TreeBuilderAttributes) -> None: text = re.sub("[¹²³⁴⁵⁶⁷⁸⁹⁰]+", "", text) # Remove footnotes if tag == xmltags.HEADING and self.nr_elements(xmltags.SECTION) == 1: self.last_level_1_section_heading = text - elif self.in_element(xmltags.MEASURE) and not self.in_element( - xmltags.SECTION, {xmltags.SECTION_IS_APPENDIX: "y"} - ): + elif self.in_element(xmltags.MEASURE) and not self.__in_appendix(): if tag == xmltags.BOLD: self.measure_row = self.row self.measure_id, measure_title = text.split(":") @@ -224,3 +222,7 @@ def __create_action_list(self) -> None: for column, (header, width) in enumerate([("Datum", 12), ("Actie", 70), ("Status", 20), ("Toelichting", 70)]): action_list.write(1, column, header, self.formats["header"]) action_list.set_column(f"{'ABCD'[column]}:{'ABCD'[column]}", width) + + def __in_appendix(self) -> bool: + """Return whether the current section is in an appendix.""" + return self.in_element(xmltags.SECTION, {xmltags.SECTION_IS_APPENDIX: "y"}) diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..5fd2714a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,6 @@ +"""Prepare the unit tests.""" + +import sys + + +sys.path.append("src")