From a0ffc78d4661335d73e25edffad1f1d0fe095e7c Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Tue, 22 Feb 2022 22:57:45 +0100 Subject: [wip] Fix date formatting in RSS builder --- build-feed.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/build-feed.py b/build-feed.py index d6de058..5fe5c04 100755 --- a/build-feed.py +++ b/build-feed.py @@ -75,14 +75,6 @@ def join(sequence, joiner_factory): result.append(joiner_factory()) -def piece_list(pieces): - ol_list = E.ol( - *(XML(f'
  • {touchup_plaintext(p)}
  • ') for p in pieces) - ) - indent(ol_list) - return ol_list - - CDATA_INDENT = 8*' ' @@ -94,14 +86,24 @@ def cdata_concert(concert, lang): if concert.warning is not None: blocks.append(E.p(concert.warning)) + with tmplocale(lang): + blocks.extend(( + E.p(formatters['date'](concert.time)), + E.p(formatters['time'](concert.time)), + )) + blocks.extend(( - E.p(formatters['date'](concert.time)), - E.p(formatters['time'](concert.time)), E.p(*join(concert.address.splitlines(), E.br)), - piece_list(concert.pieces.splitlines()), + E.ol( + *(XML(f'
  • {touchup_plaintext(p)}
  • ') + for p in concert.pieces.splitlines()) + ), *(E.p(line) for line in concert.instructions.splitlines()), )) + for b in blocks: + indent(b) + html_blocks = (tostring(b, encoding='utf-8').decode() for b in blocks) cdata = '\n' + '\n'.join(html_blocks) + '\n' -- cgit v1.2.3