summaryrefslogtreecommitdiff
path: root/build-feed.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2022-02-22 12:51:48 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2022-02-22 12:53:00 +0100
commit3bc002e5c87f1042791c4ec67ce7ae6ab3878bce (patch)
treea2fcf2f54e786cbf5e5c0d593f890558bd2dc013 /build-feed.py
parent467f96cf68b121400c835683cf87b11db8c1c7b2 (diff)
downloadquatuorbellefeuille.com-3bc002e5c87f1042791c4ec67ce7ae6ab3878bce.tar.xz
[wip] Add CDATA (cont'd and over)
Now we just need to add the publication date.
Diffstat (limited to 'build-feed.py')
-rwxr-xr-xbuild-feed.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/build-feed.py b/build-feed.py
index a6b0890..e200920 100755
--- a/build-feed.py
+++ b/build-feed.py
@@ -38,6 +38,19 @@ LOCALIZED_FORMATS = {
}
+def join(sequence, joiner_factory):
+ # There's got to be a standard itertools/functools thingy to do that…
+ result = []
+
+ for i, item in enumerate(sequence, start=1):
+ result.append(item)
+
+ if i == len(sequence):
+ return result
+
+ result.append(joiner_factory())
+
+
def cdata_concert(concert, lang):
formatters = DATE_FORMATTERS[lang]
@@ -49,8 +62,7 @@ def cdata_concert(concert, lang):
blocks.extend((
E.p(formatters['date'](concert.time)),
E.p(formatters['time'](concert.time)),
- # TODO: NEED TO USE FUNC/ITERTOOLS SHENANIGANS TO WEAVE E.br INTO THIS
- E.p(concert.address.replace('\n', '<br>')),
+ E.p(*join(concert.address.splitlines(), E.br)),
E.ol(
*(E.li(touchup_plaintext(p)) for p in concert.pieces.splitlines())
),