diff --git a/rules_doc_generator/input/yaml/parser.py b/rules_doc_generator/input/yaml/parser.py index 693053b..14875fd 100644 --- a/rules_doc_generator/input/yaml/parser.py +++ b/rules_doc_generator/input/yaml/parser.py @@ -101,9 +101,10 @@ def parse_section(yaml_section: Any) -> Section: new = parse_boolean(yaml_section, 'new') text = parse_format_text_field(yaml_section, 'text') toc_entry = parse_with_default(yaml_section, 'toc_entry', None, parse_str_field) + steps = parse_boolean(yaml_section, 'steps') snippet = parse_with_default(yaml_section, 'snippet', None, parse_format_text_field) section_elements = parse_subelements(yaml_section, 'rules', parse_section_element) - return Section(id, new, text, toc_entry, snippet, section_elements) + return Section(id, new, text, toc_entry, steps, snippet, section_elements) def parse_chapter(yaml_chapter: Any) -> Chapter: id = parse_id(yaml_chapter, 'chapter') diff --git a/rules_doc_generator/model/analysis/references.py b/rules_doc_generator/model/analysis/references.py index 105e046..93d56e0 100644 --- a/rules_doc_generator/model/analysis/references.py +++ b/rules_doc_generator/model/analysis/references.py @@ -35,11 +35,12 @@ def _construct_reference_map( ref_map[id] = RefInfo(f'{chapter_index}', 'section', text, id, toc=True) for i, section in enumerate(sections): _construct_reference_map(section, ref_map, chapter_index, i+1, 0, 0) - case Section(id=id, section_elements=section_elements, text=text): + case Section(id=id, section_elements=section_elements, text=text, steps=steps): check_id_defined(ref_map, id) ref_map[id] = RefInfo(f'{chapter_index}.{section_index}', 'section', element.toc_text(), id, toc=True) + sub_ref_type = 'step' if steps else 'rule' for i, section_element in enumerate(section_elements): - _construct_reference_map(section_element, ref_map, chapter_index, section_index, i+1, 0) + _construct_reference_map(section_element, ref_map, chapter_index, section_index, i+1, 0, sub_ref_type) case SubSection(id=id, rules=rules, steps=steps, toc=toc): if id is not None: check_id_defined(ref_map, id) diff --git a/rules_doc_generator/model/section.py b/rules_doc_generator/model/section.py index 41e8aff..db166e0 100644 --- a/rules_doc_generator/model/section.py +++ b/rules_doc_generator/model/section.py @@ -260,6 +260,7 @@ class Section: new: bool text: FormatText toc_entry: str | None + steps: bool snippet: Optional[FormatText] section_elements: list[SectionElement]