diff --git a/_scripts/generate.py b/_scripts/generate.py index 557f5d8..9708f16 100644 --- a/_scripts/generate.py +++ b/_scripts/generate.py @@ -122,13 +122,13 @@ def render_list_group(element, acc): def render_list_item(element, acc): acc.append("
  • ") - if element.content.tag is not None: + if element.tag is not None: acc.append("") - acc.append(element.content.tag) + acc.append(element.tag) acc.append("") acc.append("") - acc.append(token_list_to_raw(element.content.content)) + render_text_tokens(element.content, acc) acc.append("
  • ") @@ -137,14 +137,19 @@ def render_code_block(element, acc): def render_text(element, acc): - for chunk in element.content: + acc.append('') + render_text_tokens(element.content, acc) + acc.append('') + +def render_text_tokens(tokens, acc): + for chunk in tokens: if isinstance(chunk, str): - acc.append('{} '.format(chunk)) + acc.append('{} '.format(chunk)) elif isinstance(chunk, Link): # @TODO: URLEscape acc.append('{}'.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)