hgbook
diff en/fixhtml.py @ 519:a529952fce96
changed "un tag" to "una etiqueta". Same thing for
"unos tags"
"un tag"
"el tag"
"los tags"
"de tag"
"de tags"
"unos tags"
"un tag"
"el tag"
"los tags"
"de tag"
"de tags"
author | Javier Rojas <jerojasro@devnull.li> |
---|---|
date | Sun Jan 18 22:21:43 2009 -0500 (2009-01-18) |
parents | 2e73abddad21 |
children |
line diff
1.1 --- a/en/fixhtml.py Wed May 30 21:50:21 2007 -0700 1.2 +++ b/en/fixhtml.py Sun Jan 18 22:21:43 2009 -0500 1.3 @@ -22,6 +22,7 @@ 1.4 angle_re = re.compile(r'([CE];)') 1.5 unicode_re = re.compile(r'�([0-7][0-9A-F]);') 1.6 fancyvrb_re = re.compile(r'id="fancyvrb\d+"', re.I) 1.7 +ligature_re = re.compile(r'ྰ([0-4]);') 1.8 1.9 tmpsuffix = '.tmp.' + str(os.getpid()) 1.10 1.11 @@ -31,12 +32,18 @@ 1.12 def fix_ascii(m): 1.13 return chr(int(m.group(1), 16)) 1.14 1.15 +ligatures = ['ff', 'fi', 'fl', 'ffi', 'ffl'] 1.16 + 1.17 +def expand_ligature(m): 1.18 + return ligatures[int(m.group(1))] 1.19 + 1.20 for name in sys.argv[1:]: 1.21 tmpname = name + tmpsuffix 1.22 ofp = file(tmpname, 'w') 1.23 for line in file(name): 1.24 line = angle_re.sub(hide_angle, line) 1.25 line = unicode_re.sub(fix_ascii, line) 1.26 + line = ligature_re.sub(expand_ligature, line) 1.27 line = fancyvrb_re.sub('id="fancyvrb"', line) 1.28 ofp.write(line) 1.29 ofp.close()