Commit 7155a07c0cdf67519fc55a08e30007e927e06398
Parse Gemini-format links into HTML links
Grey Nicholson committed on 5/15/2022, 5:51:42 PMParent: 59c0f9d88cdd78f718fca44638dffb31ada0c2a1
Files changed
generator/common.py | changed |
generator/common.py | |||
---|---|---|---|
@@ -58,8 +58,20 @@ | |||
58 | 58 … | colour_class = f"month-{list(reversed(months))[0].month:02d}" | |
59 | 59 … | ||
60 | 60 … | ||
61 | 61 … | def convert_to_html(hypertext): | |
62 … | + hypertext = "\n".join( | ||
63 … | + [ | ||
64 … | + re.sub(r"^=>\s*(\S+)\s+(.*)$", r'<p><a href="\1">\2</a></p>', line) | ||
65 … | + for line in hypertext.split("\n") | ||
66 … | + ] | ||
67 … | + ) | ||
68 … | + hypertext = "\n".join( | ||
69 … | + [ | ||
70 … | + re.sub(r"^=>\s*(\S+)$", r'<p><a href="\1">\1</a></p>', line) | ||
71 … | + for line in hypertext.split("\n") | ||
72 … | + ] | ||
73 … | + ) | ||
62 | 74 … | return marko.convert(hypertext) | |
63 | 75 … | ||
64 | 76 … | ||
65 | 77 … | def entries_in_series(series): |
Built with git-ssb-web