From 918dd477966dde50289ca656ca4d3772830c30dd Mon Sep 17 00:00:00 2001 From: sergiusz Date: Mon, 7 Dec 2020 22:02:36 +0100 Subject: [PATCH] Modiefied text2pensum.py to keep aword and a cloze in the same line --- text2pensum.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/text2pensum.py b/text2pensum.py index 965aefa..a3223b4 100644 --- a/text2pensum.py +++ b/text2pensum.py @@ -6,11 +6,11 @@ for filename in sys.argv[1:]: content = infile.read() # Replace _string_ with html - html_head = '' - html_tail = '"/>' - content = re.sub(r'_([a-zA-Z\-]+)_', html_head+r'\1'+html_tail, content) + html_span_head = '' + html_input_head = '' + html_span_tail = '' + content = re.sub(r'(\s|\")([a-zA-Z\-\ÿ]+|)_([a-zA-Z\-]+)_(\.|)', r'\1' + html_span_head + r'\2' + html_input_head + r'\3' + html_input_tail + r'\4' + html_span_tail, content) # Replace vowel-dash-vowel with vowels with macrons content = content.replace('A-A', 'Ā')