summaryrefslogtreecommitdiff
path: root/admin/feeds/build-feed.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2022-02-23 10:37:11 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2022-02-23 10:37:11 +0100
commita7b877da001054378e86cb32bc8a9467423f7e5d (patch)
tree827c536753d06657f5691ab5ef3c3a92a8b34b81 /admin/feeds/build-feed.py
parent66b5366b7b377f9e595ee9b97261b65a0064aa5b (diff)
downloadquatuorbellefeuille.com-a7b877da001054378e86cb32bc8a9467423f7e5d.tar.xz
Remove superfluous whitespace from feeds
Diffstat (limited to 'admin/feeds/build-feed.py')
-rwxr-xr-xadmin/feeds/build-feed.py11
1 files changed, 5 insertions, 6 deletions
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):