quatuorbellefeuille.com

Content, build scripts and admin scripts for the Bellefeuille Quartet website.
git clone https://git.kevinlegouguec.net/quatuorbellefeuille.com
Log | Files | Refs

commit 3bc002e5c87f1042791c4ec67ce7ae6ab3878bce
parent 467f96cf68b121400c835683cf87b11db8c1c7b2
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Tue, 22 Feb 2022 12:51:48 +0100

[wip] Add CDATA (cont'd and over)

Now we just need to add the publication date.

Diffstat:
Mbuild-feed.py | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git 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()) ),