Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improve regex for finding page references in aux file
  • Loading branch information
kthoden committed Sep 4, 2020
1 parent 978cebb commit d2b4c39
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/eoatex2imxml.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2020-09-01 14:12:52 (kthoden)>
# Time-stamp: <2020-09-03 15:57:40 (kthoden)>

"""
Converts Latex files into a customized DocBook XML file.
Expand Down Expand Up @@ -1010,12 +1010,14 @@ def process_page_references( latex_dir, set_citations ):
# \newlabel{BL}{{\caption@xref {facsim033}{ on input line 37}}{231}{Secondary Literature}{figure.caption.87}{}}
# \newlabel{BL}{{1.1}{4}{Forschungsüberblick zur Literatur über Alvarus Thomas}{section.1.1}{}}
# \newlabel{BL}{{1.1}{4}}
matched_label = re.match(r'\\newlabel\{(.*?)\}\{\{(.*?)\}\{(.*?)\}\}\{(.*?)\}', line)
auxpattern = re.compile("\\\\newlabel\{(?P<label>.*?)\}\{\{(?P<num1>.*?)\}\{(?P<pagenumber>.*?)\}\{(?P<sectionname>.*?)\}\{(?P<another>.*?)\}\{(?P<whatever>.*?)\}\}")
matched_label = re.match(auxpattern, line)
# matched_label = re.match(r'\\newlabel\{(.*?)\}\{\{(.*?)\}\{(.*?)\}\}\{(.*?)\}', line)
# matchObjectLabel = re.match(r'\newlabel\{(.*?)\}', line)
if matched_label:
# matchObjectPage = re.match(r'(.*?)\}\{(\d{1,})\}\}$', line)
# if matchObjectPage:
dictPagelabels[matched_label.group(1)] = matched_label.group(4)
dictPagelabels[matched_label.group('label')] = matched_label.group('pagenumber')
# parsing out information on cite works
matched_citation = re.match(r'\\abx@aux@cite{(.*?)}', line)
if matched_citation is not None:
Expand Down

0 comments on commit d2b4c39

Please sign in to comment.