|
12 | 12 | @author: Hans Peter de Koning (DEKonsult) |
13 | 13 |
|
14 | 14 | Requirements: |
15 | | -This tool requires installation of the following packages: |
| 15 | +This tool requires Python v3.9 or higher and installation of the following packages: |
16 | 16 | - beautifulsoup4 (See https://pypi.org/project/beautifulsoup4/) |
| 17 | +- lxml (See https://pypi.org/project/lxml/) |
17 | 18 | - lark (See https://pypi.org/project/lark) |
18 | 19 | """ |
19 | 20 |
|
|
28 | 29 | from enum import Enum, auto |
29 | 30 | from logging import Logger |
30 | 31 | from textwrap import wrap |
31 | | -from types import NoneType |
32 | 32 | from typing import Any, ClassVar, Iterable, Optional |
33 | 33 |
|
34 | | -from bs4 import BeautifulSoup, Tag, PageElement, NavigableString |
| 34 | +from bs4 import BeautifulSoup, Tag, PageElement |
35 | 35 |
|
36 | | -from lark import Lark, Transformer, Tree, UnexpectedInput |
| 36 | +from lark import Lark, UnexpectedInput |
37 | 37 |
|
38 | 38 | # Create logger for diagnostic messages at debug, info, warning, error and critical levels |
39 | 39 | import logging |
@@ -661,7 +661,7 @@ def extract_bnf_from_spec(self, input_dir: str, output_dir: str, input_file: str |
661 | 661 | elif tag.name == "ol" and inside_bnf_clause and contains_pre_tag and tag.parent.name != "li": |
662 | 662 | LOGGER.debug(f"note <ol> tag={tag}") |
663 | 663 | list_item_count = 0 |
664 | | - note_list = NoteList(clause_id, [], []) |
| 664 | + note_list = NoteList(clause_id, [], "") |
665 | 665 |
|
666 | 666 | # Update the contents of <ol> within the HTML tree |
667 | 667 | self.cleanup_note_html(tag) |
@@ -1225,7 +1225,7 @@ def is_lower_kebab_case(text: str) -> bool: |
1225 | 1225 |
|
1226 | 1226 | def render_nested_lists(html_snippet: str, mode: RenderMode, apply_line_comment: bool) -> str: |
1227 | 1227 | """ |
1228 | | - Return |
| 1228 | + Return nested note lists, rendered as comments in HTML or TXT format. |
1229 | 1229 |
|
1230 | 1230 | :param html_snippet: string in HTML format that contains nested ol and/or ul lists |
1231 | 1231 | :param mode: output render mode |
@@ -1386,6 +1386,7 @@ def main() -> None: |
1386 | 1386 | args = parser.parse_args() |
1387 | 1387 | LOGGER.debug(f"args={args}") |
1388 | 1388 | LOGGER.debug(f"bnf_grammar_processor started in {os.getcwd()}") |
| 1389 | + LOGGER.info(f"Running Python {sys.version}") |
1389 | 1390 |
|
1390 | 1391 | input_dir = args.input_dir |
1391 | 1392 | output_dir = args.output_dir |
|
0 commit comments