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() content = infile.read()
# Replace _string_ with html # Replace _string_ with html
html_head = '<input type="text" data-expected="' html_span_head = '<span>'
# html_mid = '" style="width: ' html_input_head = '<input type="text" data-expected="'
# html_tail = 'em"/>' html_input_tail = '"/>'
html_tail = '"/>' html_span_tail = '</span>'
content = re.sub(r'_([a-zA-Z\-]+)_', html_head+r'\1'+html_tail, content) 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 # Replace vowel-dash-vowel with vowels with macrons
content = content.replace('A-A', 'Ā') content = content.replace('A-A', 'Ā')