eyes17/helpFiles/fixMathInRst.py
raw| 1 | import re, sys |
| 2 | |
| 3 | t = "" |
| 4 | for fName in sys.argv[1:]: |
| 5 | with open(fName) as infile: |
| 6 | t=infile.read() |
| 7 | |
| 8 | if '\u2005' in t or '\u2212' in t or "⋯" in t: |
| 9 | with open(fName,"w") as outfile: |
| 10 | t = re.sub('\u2212', ' ', t) |
| 11 | t = re.sub(r'(:math:`.*)⋯([^`]*\`)', r'\1\\dots\2', t) |
| 12 | outfile.write(re.sub('\u2005', ' ', t)) |
| 13 | |
| 14 | print ("replaced non-ascii spaces by ordinary spaces in", fName) |