Add links to LinkItems.
This commit is contained in:
parent
c86ec3fc9b
commit
8295154a96
@ -122,13 +122,13 @@ def render_list_group(element, acc):
|
||||
|
||||
def render_list_item(element, acc):
|
||||
acc.append("<li>")
|
||||
if element.content.tag is not None:
|
||||
if element.tag is not None:
|
||||
acc.append("<span class='tag'>")
|
||||
acc.append(element.content.tag)
|
||||
acc.append(element.tag)
|
||||
acc.append("</span>")
|
||||
|
||||
acc.append("<span class='item'>")
|
||||
acc.append(token_list_to_raw(element.content.content))
|
||||
render_text_tokens(element.content, acc)
|
||||
acc.append("</span></li>")
|
||||
|
||||
|
||||
@ -137,14 +137,19 @@ def render_code_block(element, acc):
|
||||
|
||||
|
||||
def render_text(element, acc):
|
||||
for chunk in element.content:
|
||||
acc.append('<span class="text">')
|
||||
render_text_tokens(element.content, acc)
|
||||
acc.append('</span>')
|
||||
|
||||
def render_text_tokens(tokens, acc):
|
||||
for chunk in tokens:
|
||||
if isinstance(chunk, str):
|
||||
acc.append('<span class="text">{}</span> '.format(chunk))
|
||||
acc.append('{}</span> '.format(chunk))
|
||||
elif isinstance(chunk, Link):
|
||||
# @TODO: URLEscape
|
||||
acc.append('<a href="{}">{}</a>'.format(chunk.value, chunk.description))
|
||||
else:
|
||||
raise NotImplemented()
|
||||
raise NotImplementedError('TextToken: {}'.format(chunk))
|
||||
|
||||
|
||||
def render_tag(element, acc):
|
||||
@ -165,8 +170,8 @@ def render_tree(tree, acc):
|
||||
|
||||
|
||||
def render(headline, doc):
|
||||
# if headline.id != "41b1ee7e-ddbf-41ff-bc79-18258506ebe6":
|
||||
# return ""
|
||||
if headline.id != "ea48ec1d-f9d4-4fb7-b39a-faa7b6e2ba95":
|
||||
return ""
|
||||
print("\n===========")
|
||||
dom = headline.as_dom()
|
||||
print_tree(dom)
|
||||
|
Loading…
Reference in New Issue
Block a user