Revision f84e6ddc8930927f632f74c08860095d9eb41a56 authored by Daniel Fort on 20 January 2019, 00:20:21 UTC, committed by Daniel Fort on 20 January 2019, 00:20:21 UTC
1 parent c33e133
mkdoc_utils.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
def system_or_exit(cmdline):
ret = os.system(cmdline)
if ret != 0:
sys.exit(1)
def include(o, filename, start=0):
f = open(filename).readlines();
for l in f[start:]:
o.write(l)
o.write("\n");
def sed_sub_tex_spec_chars(filename):
system_or_exit(r"sed -i -e 's/⬜/$\\square$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/⨂/$\\otimes$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/⨀/$\\odot$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/〰/$\\wave$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/↷/$\\curvearrowright$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/↶/$\\curvearrowleft$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/⤿/$\\rcurvearrowup$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/⤸/$\\lcurvearrowdown$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/<->/$\\leftrightarrow$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/->/$\\rightarrow$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/=>/$\\Rightarrow$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/>=/$\\ge$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/<=/$\\le$/g' %s" % (filename,))
system_or_exit(r"sed -i -e 's/kOhm/$\\textrm k\\Omega$/g' %s" % (filename,))
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...