From 5876793d01ab2e392e93eec9323dd6a7edb53170 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 21 Feb 2022 19:57:49 +0100 Subject: Extract more stuff out of build-concerts.py --- build-concerts.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'build-concerts.py') diff --git a/build-concerts.py b/build-concerts.py index d1a7c11..0e5a70b 100755 --- a/build-concerts.py +++ b/build-concerts.py @@ -5,7 +5,13 @@ from pathlib import Path import re from sys import argv -from helpers import guess_language, read_concerts, relative_path, tmplocale +from helpers import ( + guess_language, + read_concerts, + relative_path, + tmplocale, + touchup_plaintext, +) # TODO: change some jargon: @@ -162,20 +168,6 @@ def break_lines(lines): return tuple(line+'
' for line in lines[:-1]) + (lines[-1],) -TOUCHUPS = ( - (re.compile('([0-9])(st|nd|rd|th|er|ère|nde|ème)'), r'\1\2'), - (re.compile('(https://[^ ]+)'), r'\1'), - (re.compile('([^ ]+@[^ ]+)'), r'\1'), -) - - -def touchup_plaintext(plaintext): - text = plaintext - for regexp, repl in TOUCHUPS: - text = regexp.sub(repl, text) - return text - - def print_concert_details(concert, lang): concert_id = f'concert-{concert.time.strftime("%F")}' classes = ('details',) -- cgit v1.2.3