Skip to content
Snippets Groups Projects
Commit 6f5e7634 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

allow structure elements in conversion

parent 24340511
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!167Sync Graph
Pipeline #51567 passed with warnings
...@@ -715,7 +715,9 @@ class MarkdownFileConverter(SimpleFileConverter): ...@@ -715,7 +715,9 @@ class MarkdownFileConverter(SimpleFileConverter):
def convert_basic_element(element: Union[list, dict, bool, int, float, str, None], name=None, def convert_basic_element(element: Union[list, dict, bool, int, float, str, None], name=None,
msg_prefix=""): msg_prefix=""):
"""Convert basic Python objects to the corresponding StructureElements""" """Convert basic Python objects to the corresponding StructureElements"""
if isinstance(element, list): if isinstance(element, StructureElement):
return element
elif isinstance(element, list):
return ListElement(name, element) return ListElement(name, element)
elif isinstance(element, dict): elif isinstance(element, dict):
return DictElement(name, element) return DictElement(name, element)
...@@ -1078,7 +1080,7 @@ class ListElementConverter(Converter): ...@@ -1078,7 +1080,7 @@ class ListElementConverter(Converter):
# TODO: See comment on types and inheritance # TODO: See comment on types and inheritance
if not isinstance(element, ListElement): if not isinstance(element, ListElement):
raise RuntimeError( raise RuntimeError(
"This converter can only process DictListElements.") "This converter can only process ListElements.")
children: list[StructureElement] = [] children: list[StructureElement] = []
for index, list_element in enumerate(element.value): for index, list_element in enumerate(element.value):
children.append( children.append(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment