diff --git a/_scripts/generate.py b/_scripts/generate.py index f5f328d..7b2aff0 100644 --- a/_scripts/generate.py +++ b/_scripts/generate.py @@ -144,7 +144,7 @@ def render_list_item(element, acc): acc.append("
')
- acc.append(element.lines)
+ acc.append(html.escape(element.lines))
acc.append('
')
@@ -168,11 +168,17 @@ def render_text_tokens(tokens, acc):
if isinstance(chunk, str):
acc.append('{} '.format(chunk))
elif isinstance(chunk, Link):
- # @TODO: URLEscape
link_target = chunk.value
if link_target.startswith('id:'):
link_target = './' + link_target[3:] + '.node.html'
- acc.append('{}'.format(link_target, chunk.description))
+ description = chunk.description
+ if description is None:
+ description = chunk.value
+
+ acc.append('{}'.format(
+ html.escape(link_target),
+ html.escape(description),
+ ))
else:
raise NotImplementedError('TextToken: {}'.format(chunk))