git ssb

0+

Grey the earthling / gkn.me.uk



Commit 59c0f9d88cdd78f718fca44638dffb31ada0c2a1

Abstract converting to HTML

Make and use a new function in common.py that converts markup to HTML, so that I can later add processing other than just `marko.convert`.
Grey Nicholson committed on 5/15/2022, 5:29:21 PM
Parent: b9e674f6a58e57b2bb9df216b779c9375cca9957

Files changed

generator/common.pychanged
generator/templates/entry.pychanged
generator/common.pyView
@@ -46,9 +46,9 @@
4646 )
4747 )
4848 + '<content type="html">'
4949 + "\n"
50- + print_html_escaped(marko.convert(entries[id].content))
50 + + print_html_escaped(convert_to_html(entries[id].content))
5151 + "</content>"
5252 + "</entry>"
5353 )
5454
@@ -57,8 +57,12 @@
5757
5858 colour_class = f"month-{list(reversed(months))[0].month:02d}"
5959
6060
61 +def convert_to_html(hypertext):
62 + return marko.convert(hypertext)
63 +
64 +
6165 def entries_in_series(series):
6266 return dict(
6367 [
6468 (id, entries[id])
generator/templates/entry.pyView
@@ -1,6 +1,4 @@
1-import marko
2-
31 import common
42
53
64 def links_to_nearby_entries(id):
@@ -168,9 +166,13 @@
168166 if "series" in entry
169167 else ""
170168 )
171169 description = (
172- ('<div class="description">' + marko.convert(entry["description"]) + "</div>")
170 + (
171 + '<div class="description">'
172 + + common.convert_to_html(entry["description"])
173 + + "</div>"
174 + )
173175 if "description" in entry
174176 else ""
175177 )
176178 entry_links = (
@@ -236,9 +238,9 @@
236238 </header>
237239 <main>
238240 <hr/>
239241 <section>
240- {marko.convert(entry.content)}
242 + {common.convert_to_html(entry.content)}
241243 </section>
242244 <footer>
243245 <hr/>
244246 <section>

Built with git-ssb-web