diff options
| -rwxr-xr-x | build-feed.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/build-feed.py b/build-feed.py index a6b0890..e200920 100755 --- 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()) ), |
