Skip to content

Commit

Permalink
Support for inline citations
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Thoden committed Mar 5, 2018
1 parent 28fbff9 commit cab7a4f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions prepare_tei.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def convert_citations(string):
<citedRange from="320" to="322"/>
</bibl>
"""
inline_citation_pattern = re.compile(r"(§|&#xA7;|&#167;)(§|&#xA7;|&#167;)(?P<citekey>.+?)(\!(?P<pages>.*?))?(§|&#xA7;|&#167;)(§|&#xA7;|&#167;)")
inline_citations = re.findall(inline_citation_pattern, string)
logging.info("Found %s inline citations." % len(inline_citations))
string = re.sub(inline_citation_pattern, r"<bibl><ref type='inline' target='#\g<citekey>'/><citedRange from='\g<pages>'/></bibl>", string)

citation_pattern = re.compile(r"(§|&#xA7;|&#167;)(?P<citekey>.+?)(\!(?P<pages>.*?))?(§|&#xA7;|&#167;)")
citations = re.findall(citation_pattern, string)
Expand Down

0 comments on commit cab7a4f

Please sign in to comment.