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', 'Ā')