summaryrefslogtreecommitdiff
path: root/build-concerts.py
diff options
context:
space:
mode:
Diffstat (limited to 'build-concerts.py')
-rwxr-xr-xbuild-concerts.py22
1 files changed, 7 insertions, 15 deletions
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+'<br>' for line in lines[:-1]) + (lines[-1],)
-TOUCHUPS = (
- (re.compile('([0-9])(st|nd|rd|th|er|ère|nde|ème)'), r'\1<sup>\2</sup>'),
- (re.compile('(https://[^ ]+)'), r'<a href="\1" target="_blank">\1</a>'),
- (re.compile('([^ ]+@[^ ]+)'), r'<a href="mailto:\1">\1</a>'),
-)
-
-
-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',)