25 lines
792 B
Python
Executable File
25 lines
792 B
Python
Executable File
import sys
|
|
import re
|
|
|
|
with open(sys.argv[1], 'r') as infile:
|
|
content = infile.read()
|
|
|
|
# Replace _string_ with html
|
|
html_head = '<input type="text" size="1" data-expected="'
|
|
html_tail = '" required/>'
|
|
content = re.sub(r'_([a-zA-Z\-]+)_', html_head+r'\1'+html_tail, content)
|
|
|
|
# Replace vowel-dash-vowel with vowels with macrons
|
|
content = content.replace('A-A', 'Ā')
|
|
content = content.replace('a-a', 'ā')
|
|
content = content.replace('E-E', 'Ē')
|
|
content = content.replace('e-e', 'ē')
|
|
content = content.replace('I-I', 'Ī')
|
|
content = content.replace('i-i', 'ī')
|
|
content = content.replace('O-O', 'Ō')
|
|
content = content.replace('o-o', 'ō')
|
|
content = content.replace('U-U', 'Ū')
|
|
content = content.replace('u-u', 'ū')
|
|
|
|
with open(sys.argv[1] + '.html', 'w+') as outfile:
|
|
outfile.write(content) |