diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-27 08:47:52 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-27 12:39:00 +0100 |
commit | 791893216a3cb043781195a4ce6c7fb3ad82539b (patch) | |
tree | 36d0ada31434b274d8511bb857644693dbd003f7 | |
parent | ababb3164ec649d090b361595cb86ee450a0fde1 (diff) |
html: turn `` into <code></code>
-rwxr-xr-x | build.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,9 +1,10 @@ #!/usr/bin/env python3 import glob +import html import json import os +import re import shutil -import html import toml @@ -85,8 +86,9 @@ def write_features(f, feature_data): if url: f.write(f' href="{url}"') f.write('>') - # TODO: convert `..` into <code>..</code> - f.write(html.escape(data['title'])) + title = html.escape(data['title']) + title = re.sub('`(.+?)`', lambda m: '<code>{}</code>'.format(m.group(1)), title) + f.write(title) f.write('</a></li>') f.write('</ul>') |