diff --git a/scripts/generate.py b/scripts/generate.py index 5730e9e..2c4cae8 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -424,7 +424,7 @@ def render_text_tokens(tokens, acc, headline, graph): or word.startswith('ftps://') ): raise Exception('Is this a link? {} (on {})\nLine: {}\nChunks: {}'.format(word, headline.doc.path, line, chunks)) - line_chunks.append('{description}' + line_chunks.append('{description}' .format(url=word, description=html.escape(word))) else: @@ -435,6 +435,7 @@ def render_text_tokens(tokens, acc, headline, graph): elif isinstance(chunk, Link): link_target = chunk.value + is_internal_link = True if link_target.startswith('id:'): link_target = './' + link_target[3:] + '.node.html' elif link_target.startswith('./') or link_target.startswith('../'): @@ -456,6 +457,7 @@ def render_text_tokens(tokens, acc, headline, graph): else: link_target = './' + target_headline.id + '.node.html' else: + is_internal_link = False if not ( link_target.startswith('https://') or link_target.startswith('http://') @@ -467,8 +469,9 @@ def render_text_tokens(tokens, acc, headline, graph): if description is None: description = chunk.value - acc.append('{}'.format( + acc.append('{}'.format( html.escape(link_target), + 'internal' if is_internal_link else 'external', html.escape(description), )) # else: diff --git a/static/style.css b/static/style.css index 9f6e141..97ef9fc 100644 --- a/static/style.css +++ b/static/style.css @@ -300,6 +300,12 @@ tr.__table-separator { a { color: #00fdf2; } + a.internal::before { + content: '{ '; + } + a.internal::after { + content: ' }'; + } h1,h2,h3,h4,h5,h6 { color: #f7da4a; }