Created
January 13, 2016 13:25
-
-
Save ansmirnov/5df53108b976a1694cef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# prepare_tex.py | |
import sys | |
import re | |
def cat(fn): | |
return open(fn, 'rt').read().replace('\\', '====') | |
def prepare_tex(fn): | |
r = cat(fn) | |
for s in re.findall(r'====input{([-a-zA-Z._0-9/]*)}', r): | |
cs = prepare_tex(s) | |
r = re.sub(r'====input{' + s + '}', cs, r) | |
return r | |
print prepare_tex(sys.argv[1]).replace('====', '\\') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment