From 099395ed6f5b3694c0c733293c241140089cbfe7 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Tue, 22 Feb 2022 22:39:18 +0100 Subject: [wip] Make sure "touched up" plaintext is not mangled --- build-feed.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build-feed.py b/build-feed.py index 2359344..d6de058 100755 --- a/build-feed.py +++ b/build-feed.py @@ -7,7 +7,7 @@ from sys import argv from urllib.parse import urljoin from lxml.builder import E -from lxml.etree import CDATA, indent, tostring +from lxml.etree import CDATA, XML, indent, tostring from helpers import ( DATE_FORMATTERS, @@ -75,6 +75,14 @@ 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*' ' @@ -90,9 +98,7 @@ def cdata_concert(concert, lang): E.p(formatters['date'](concert.time)), E.p(formatters['time'](concert.time)), E.p(*join(concert.address.splitlines(), E.br)), - E.ol( - *(E.li(touchup_plaintext(p)) for p in concert.pieces.splitlines()) - ), + piece_list(concert.pieces.splitlines()), *(E.p(line) for line in concert.instructions.splitlines()), )) -- cgit v1.2.3