Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ongoing work
  • Loading branch information
Klaus Thoden committed Jan 22, 2018
1 parent 1b34412 commit 7e07d13
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions eoaconvert.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2018-01-22 16:59:11 (kthoden)>
# Time-stamp: <2018-01-22 18:57:49 (kthoden)>

# license?
__version__= "1.0"
Expand Down Expand Up @@ -964,11 +964,10 @@ def cleanup():
citeproc_process = subprocess.Popen(citeproc_arguments, stdout=subprocess.PIPE)
citeproc_json = citeproc_process.stdout.read()

jsonObj = json.loads(citeproc_json)

for x in jsonObj:
print(x["title"])
citations_json = json.loads(citeproc_json)

# for x in citations_json:
# print(x["title"])

####################
# the old solution #
Expand Down Expand Up @@ -1057,6 +1056,30 @@ def cleanup():
xmlBibliography.tag = "div"
xmlBibliography.getparent().tag = "div"
#xmlBibliography.addnext(xmlBibliographyDiv)

###############
# new version #
###############

formatted_references = libeoaconvert.format_citations(set_citations, bib_database + ".bib")[0]

# to check: is the order correct?
entries = formatted_references.findall(".//div")

for entry in entries:
entry_id = entry.get("id")
entry.set("class", "bibliography")
etree.strip_tags(entry, "p")
entry.tag = "p"
xmlBibliography.append(entry)

######################
# end of new version #
######################

###############
# old version #
###############
xmlEntries = xmlBibTree.findall(".//entry")
intNumberOfEntry = 0
for xmlEntry in xmlEntries:
Expand All @@ -1080,9 +1103,13 @@ def cleanup():
print("a new entry", strNewentry)

xmlNew = etree.fromstring(strNewentry)
xmlBibliography.append(xmlNew)
# xmlBibliography.append(xmlNew)

intNumberOfEntry += 1
######################
# end of old version #
######################


# If Bibliography-Type is anthology search for EOAbibliography and make one per chapter
if xmlTree.find(".//EOAbibliographytype").text == "anthology":
Expand Down

0 comments on commit 7e07d13

Please sign in to comment.