diff --git a/latex2eoa.py b/latex2eoa.py index 4d1358c..f6325dc 100644 --- a/latex2eoa.py +++ b/latex2eoa.py @@ -11,20 +11,20 @@ # to be dealt with: EOAfigure regex_replacements = { - # r"{\\itshape" : r"\\EOAemph{", - r"\\xref" : r"\\EOAurl", - r"\\uline{\\itshape " : r"\\EOAemph{", - r"{\\itshape " : r"\\EOAemph{", - r"\\uline\{" : r"\\EOAcaps{", - r"\\par" : "\\n\\n", - r"{\\bfseries " : r"\\EOAbold{", - r"\\label\{ftn[0-9]{1,3}}\\footnote" : "\\EOAfn", - r"\\footnote" : r"\\EOAfn", - r"\\label" : r"\\EOAlabel", - r"{enumerate}" : r"{EOAlist}", - r"{itemize}" : r"{EOAitems}", - r"\\color{FF0000}" : r"\\color[rgb]{1,0,0}", - r"\\color{0000FF}" : r"\\color[rgb]{0,0,1}" + r'\$\$(.*?)\$\$' : r"\\begin{EOAequationnonumber}\g<1>\\end{EOAequationnonumber}", + r'\$(.*?)\$' : r"\\EOAineq{\g<1>}", + r'\\section' : r"\\EOAsection", + r'{\\em' : r"\\EOAemph{", + r'\\begin{equation}' : r"\\begin{EOAequation}{equation_label}", + r'\\end{equation}' : r"\\end{EOAequation}", + r'\\(begin|end){quote}' : r"\\\g<1>{EOAquote}", + r'\\(begin|end){itemize}' : r"\\\g<1>{EOAitems}", + r'\\label' : r"\\EOAlabel", + r'\\ref' : r"\\EOAref", + r'\\citet' : r"\\EOAciteauthoryear", + r'{\\bf' : r"\\EOAbold{", + r'\\footnote' : r"\\EOAfn", + r'\\bibliography{' : r"\\EOAbibliographydatabase{" } def find_latex_commands(string): @@ -44,11 +44,11 @@ def main(infile): with open(infile, 'r') as input_file: data = input_file.read() - # list_of_commands = find_latex_commands(input_text) + # list_of_commands = find_latex_commands(data) + # print(list_of_commands) for instance in regex_replacements.keys(): data = re.sub(instance, regex_replacements[instance], data) - print(data) # def main ends here