Skip to content

Commit b31f217

Browse files
committed
Minor
1 parent 3364f79 commit b31f217

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

jsondoc/convert/html.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -387,24 +387,15 @@ def is_nested_node(el):
387387

388388
if current_level_object is None:
389389
objects = children_objects
390-
elif isinstance(current_level_object, list):
391-
objects = current_level_object + children_objects
392390
elif isinstance(current_level_object, BlockBase):
393-
# objects = current_level_object
394391
objects = reconcile_to_block(current_level_object, children_objects)
395392
elif isinstance(current_level_object, RichTextBase):
396-
# There is an assumption that text formatting tags will not contain
397-
# higher level tags like blockquotes, lists, etc.
398-
# for child in children_objects:
399-
# if isinstance(child, str):
400-
# append_to_rich_text(current_level_object, child)
401-
402-
# objects = [current_level_object]
403393
objects = reconcile_to_rich_text(current_level_object, children_objects)
404-
405-
# import ipdb
406-
407-
# ipdb.set_trace()
394+
else:
395+
import ipdb; ipdb.set_trace()
396+
raise Exception(
397+
f"Current node has yielded an unexpected type {type(current_level_object)}"
398+
)
408399

409400
return objects
410401

@@ -499,11 +490,12 @@ def convert_a(self, el, convert_as_inline):
499490
# title = href
500491

501492
# title_part = ' "%s"' % title.replace('"', r"\"") if title else ""
502-
return [
503-
create_rich_text(text=prefix),
504-
create_rich_text(text=text, url=href),
505-
create_rich_text(text=suffix),
506-
]
493+
# return [
494+
# create_rich_text(text=prefix),
495+
# create_rich_text(text=text, url=href),
496+
# create_rich_text(text=suffix),
497+
# ]
498+
return create_rich_text(text=text, url=href)
507499
# return (
508500
# "%s[%s](%s%s)%s" % (prefix, text, href, title_part, suffix)
509501
# if href

tests/test_html_to_jsondoc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def test_convert_html_all_elements():
2121

2222
# print("\n\nConverted to markdown:\n\n")
2323
# print(jsondoc_to_markdown(ret[0]))
24+
# print(jsondoc_to_markdown(ret))
2425
import ipdb
2526

2627
ipdb.set_trace()

0 commit comments

Comments
 (0)