Loading md_to_docx_converter/src/constants.py +1 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ INFORMATIVE_REF_FILE = REFS # region Default Clause and Annex values DEFAULT_CLAUSES = [f"clause-{i}" for i in range(4, 21)] DEFAULT_HTML_CLAUSES = [f"clause-{i}" for i in range(1, 21)] DEFAULT_ANNEXES = [f"annex-{letter}" for letter in "abcdefghijklmnopqrstuvwxyz"] # endregion md_to_docx_converter/src/to_html/postprocessing.py +6 −8 Original line number Diff line number Diff line Loading @@ -10,14 +10,12 @@ from src.utils import ( from src.constants import ABBREVIATION_CLASS with open(os.path.join("general_gs_ts_structure.json"), "r") as f: general_gs_ts_structure = json.load(f) normative_file = "clause-2" informative_file = "clause-2" files_with_references = [ general_gs_ts_structure.get("file_with_normative_references"), general_gs_ts_structure.get("file_with_informative_references"), normative_file, informative_file ] normative_file = files_with_references[0] informative_file = files_with_references[1] # region Helpers Loading md_to_docx_converter/src/to_md/preprocessing.py +0 −7 Original line number Diff line number Diff line Loading @@ -5,13 +5,6 @@ from src.constants import HEADER_TAGS, EXAMPLE_NOTE_CLASSES from src.to_md.cleaning import cleaning as preprocess_cleaning with open(os.path.join("general_gs_ts_structure.json"), "r") as f: general_gs_ts_structure = json.load(f) files_with_references = [ general_gs_ts_structure.get("file_with_normative_references"), general_gs_ts_structure.get("file_with_informative_references"), ] # region Helpers def remove_pandoc_toc(soup: BeautifulSoup): Loading md_to_docx_converter/src/utils.py +8 −9 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from src.constants import ( CONSOLIDATED_HTML_NAME, ETSI_INITIAL_FILES, DEFAULT_CLAUSES, DEFAULT_HTML_CLAUSES, DEFAULT_ANNEXES, ETSI_FINAL_FILES, SCOPE, Loading @@ -23,10 +24,6 @@ from src.constants import ( cssutils.log.setLevel("FATAL") # Suppress irrelevant warnings and errors # with open("general_gs_ts_structure.json", "r", encoding="utf-8") as json_file: # general_gs_ts_structure = json.load(json_file) # files_order = general_gs_ts_structure.get("files_order", []) # region Warning and Error tags def p_warning(text: str): Loading Loading @@ -387,7 +384,9 @@ def handle_html_consolidation( # Include only the numbered files excluded_html_files = [CONSOLIDATED_HTML_NAME, "index.html"] ordered_files = order_local_files_by_prefix(src, excluded_html_files, "html") clauses = DEFAULT_HTML_CLAUSES annexes = DEFAULT_ANNEXES ordered_files = order_local_files_by_prefix(src, excluded_html_files, "html", clauses, annexes) create_consolidated_file(src, consolidated_html_path, ordered_files) # Clean up temporary files Loading @@ -413,8 +412,8 @@ def handle_html_consolidation( # region Files helpers def get_file_order( src_dir: str, clauses: list[str] = DEFAULT_CLAUSES, annexes: list[str] = DEFAULT_ANNEXES, clauses: list[str], annexes: list[str], ): """Return a list of strings defining the order in which the files should be processed during conversion. If no list of clauses is provided, use the default clauses. If no list of annexes is provided, use the default annexes.""" Loading Loading @@ -550,8 +549,8 @@ def order_local_files_by_prefix( src: str, excluded_files: list[str], type: Literal["html", "md"], clauses: list[str], annexes: list[str], clauses: list[str] = DEFAULT_CLAUSES, annexes: list[str] = DEFAULT_ANNEXES, ): if type not in ["html", "md"]: raise ValueError(f"Invalid type: {type}") Loading md_to_docx_converter/templates/document_skeleton/group_specification/clause-2_References.md +2 −2 Original line number Diff line number Diff line Loading @@ -15,9 +15,9 @@ While any hyperlinks included in this clause were valid at the time of publicati The following referenced documents are necessary for the application of the present document. ::: REFS [1] Reference body [n.1] Reference body [2] Reference body [n.2] Reference body ::: ## 2.2 Informative references Loading Loading
md_to_docx_converter/src/constants.py +1 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ INFORMATIVE_REF_FILE = REFS # region Default Clause and Annex values DEFAULT_CLAUSES = [f"clause-{i}" for i in range(4, 21)] DEFAULT_HTML_CLAUSES = [f"clause-{i}" for i in range(1, 21)] DEFAULT_ANNEXES = [f"annex-{letter}" for letter in "abcdefghijklmnopqrstuvwxyz"] # endregion
md_to_docx_converter/src/to_html/postprocessing.py +6 −8 Original line number Diff line number Diff line Loading @@ -10,14 +10,12 @@ from src.utils import ( from src.constants import ABBREVIATION_CLASS with open(os.path.join("general_gs_ts_structure.json"), "r") as f: general_gs_ts_structure = json.load(f) normative_file = "clause-2" informative_file = "clause-2" files_with_references = [ general_gs_ts_structure.get("file_with_normative_references"), general_gs_ts_structure.get("file_with_informative_references"), normative_file, informative_file ] normative_file = files_with_references[0] informative_file = files_with_references[1] # region Helpers Loading
md_to_docx_converter/src/to_md/preprocessing.py +0 −7 Original line number Diff line number Diff line Loading @@ -5,13 +5,6 @@ from src.constants import HEADER_TAGS, EXAMPLE_NOTE_CLASSES from src.to_md.cleaning import cleaning as preprocess_cleaning with open(os.path.join("general_gs_ts_structure.json"), "r") as f: general_gs_ts_structure = json.load(f) files_with_references = [ general_gs_ts_structure.get("file_with_normative_references"), general_gs_ts_structure.get("file_with_informative_references"), ] # region Helpers def remove_pandoc_toc(soup: BeautifulSoup): Loading
md_to_docx_converter/src/utils.py +8 −9 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ from src.constants import ( CONSOLIDATED_HTML_NAME, ETSI_INITIAL_FILES, DEFAULT_CLAUSES, DEFAULT_HTML_CLAUSES, DEFAULT_ANNEXES, ETSI_FINAL_FILES, SCOPE, Loading @@ -23,10 +24,6 @@ from src.constants import ( cssutils.log.setLevel("FATAL") # Suppress irrelevant warnings and errors # with open("general_gs_ts_structure.json", "r", encoding="utf-8") as json_file: # general_gs_ts_structure = json.load(json_file) # files_order = general_gs_ts_structure.get("files_order", []) # region Warning and Error tags def p_warning(text: str): Loading Loading @@ -387,7 +384,9 @@ def handle_html_consolidation( # Include only the numbered files excluded_html_files = [CONSOLIDATED_HTML_NAME, "index.html"] ordered_files = order_local_files_by_prefix(src, excluded_html_files, "html") clauses = DEFAULT_HTML_CLAUSES annexes = DEFAULT_ANNEXES ordered_files = order_local_files_by_prefix(src, excluded_html_files, "html", clauses, annexes) create_consolidated_file(src, consolidated_html_path, ordered_files) # Clean up temporary files Loading @@ -413,8 +412,8 @@ def handle_html_consolidation( # region Files helpers def get_file_order( src_dir: str, clauses: list[str] = DEFAULT_CLAUSES, annexes: list[str] = DEFAULT_ANNEXES, clauses: list[str], annexes: list[str], ): """Return a list of strings defining the order in which the files should be processed during conversion. If no list of clauses is provided, use the default clauses. If no list of annexes is provided, use the default annexes.""" Loading Loading @@ -550,8 +549,8 @@ def order_local_files_by_prefix( src: str, excluded_files: list[str], type: Literal["html", "md"], clauses: list[str], annexes: list[str], clauses: list[str] = DEFAULT_CLAUSES, annexes: list[str] = DEFAULT_ANNEXES, ): if type not in ["html", "md"]: raise ValueError(f"Invalid type: {type}") Loading
md_to_docx_converter/templates/document_skeleton/group_specification/clause-2_References.md +2 −2 Original line number Diff line number Diff line Loading @@ -15,9 +15,9 @@ While any hyperlinks included in this clause were valid at the time of publicati The following referenced documents are necessary for the application of the present document. ::: REFS [1] Reference body [n.1] Reference body [2] Reference body [n.2] Reference body ::: ## 2.2 Informative references Loading