From a7b877da001054378e86cb32bc8a9467423f7e5d Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Wed, 23 Feb 2022 10:37:11 +0100 Subject: Remove superfluous whitespace from feeds --- admin/feeds/build-feed.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'admin/feeds') diff --git a/admin/feeds/build-feed.py b/admin/feeds/build-feed.py index 5fe5c04..e835ad7 100755 --- a/admin/feeds/build-feed.py +++ b/admin/feeds/build-feed.py @@ -75,9 +75,6 @@ def join(sequence, joiner_factory): result.append(joiner_factory()) -CDATA_INDENT = 8*' ' - - def cdata_concert(concert, lang): formatters = DATE_FORMATTERS[lang] @@ -101,15 +98,17 @@ def cdata_concert(concert, lang): *(E.p(line) for line in concert.instructions.splitlines()), )) + # Do a silly dance to indent CDATA correctly. + 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' - cdata = re.sub('^', CDATA_INDENT, cdata, flags=re.MULTILINE) + cdata = '\n'.join(html_blocks) + '\n' + cdata = re.sub('^', 8*' ', cdata, flags=re.MULTILINE) - return CDATA(cdata) + return CDATA('\n' + cdata) def generate_concert(concert, concerts_url, pubdates, lang): -- cgit v1.2.3