Modiefied text2pensum.py to keep aword and a cloze in the same line

This commit is contained in:
sergiusz 2020-12-07 22:02:36 +01:00
parent b19cc92dce
commit 918dd47796

View File

@ -6,11 +6,11 @@ for filename in sys.argv[1:]:
content = infile.read()
# Replace _string_ with html
html_head = '<input type="text" data-expected="'
# html_mid = '" style="width: '
# html_tail = 'em"/>'
html_tail = '"/>'
content = re.sub(r'_([a-zA-Z\-]+)_', html_head+r'\1'+html_tail, content)
html_span_head = '<span>'
html_input_head = '<input type="text" data-expected="'
html_input_tail = '"/>'
html_span_tail = '</span>'
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', 'Ā')