Add markup rendering and basic styling.
This commit is contained in:
parent
f174be032e
commit
90d1c15ba7
2 changed files with 23 additions and 4 deletions
|
@ -601,8 +601,22 @@ def render_text_tokens(tokens, acc, headline, graph):
|
|||
except NonExistingLocalNoteError as err:
|
||||
logging.warning(err.get_message())
|
||||
acc.append(html.escape(description))
|
||||
# else:
|
||||
# raise NotImplementedError('TextToken: {}'.format(chunk))
|
||||
elif isinstance(chunk, org_rw.MarkerToken):
|
||||
tag = '<'
|
||||
if chunk.closing:
|
||||
tag += '/'
|
||||
tag += {
|
||||
org_rw.MarkerType.BOLD_MODE: 'strong',
|
||||
org_rw.MarkerType.CODE_MODE: 'code',
|
||||
org_rw.MarkerType.ITALIC_MODE: 'em',
|
||||
org_rw.MarkerType.STRIKE_MODE: 's',
|
||||
org_rw.MarkerType.UNDERLINED_MODE: 'span class="underlined"' if not chunk.closing else 'span',
|
||||
org_rw.MarkerType.VERBATIM_MODE: 'span class="verbatim"' if not chunk.closing else 'span',
|
||||
}[chunk.tok_type]
|
||||
tag += '>'
|
||||
acc.append(tag)
|
||||
else:
|
||||
raise NotImplementedError('TextToken: {}'.format(chunk))
|
||||
acc.append('</p>')
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue