diff --git a/eoaconvert.py b/eoaconvert.py index 1a863e2..e698636 100755 --- a/eoaconvert.py +++ b/eoaconvert.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- -# Time-stamp: <2018-02-12 16:57:53 (kthoden)> +# Time-stamp: <2018-02-13 13:18:39 (kthoden)> # license? __version__= "1.0" @@ -1152,7 +1152,12 @@ def cleanup(): xmlBibliography = xmlTree.find(".//EOAprintbibliography") xmlBibliography.clear() xmlBibliography.tag = "div" - xmlBibliography.getparent().tag = "div" + + bib_parent = xmlBibliography.getparent() + bib_parent.tag = "div" + # bib_parent.set("order", "1") + + # xmlBibliography.getparent().tag = "div" #xmlBibliography.addnext(xmlBibliographyDiv) ############### @@ -1183,31 +1188,31 @@ def cleanup(): ############### # old version # ############### - xml_bib_entries = xmlBibTree.findall(".//entry") - intNumberOfEntry = 0 - for xmlEntry in xml_bib_entries: - if intNumberOfEntry == 0: - # Don't check for previous author if first entry of the Bibliography - bibEntry = Bibitem(xmlEntry) - strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=False) + "

" - else: - bibEntry = Bibitem(xmlEntry) - # Check if author of previous Entry is the same - bibEntryPrevious = Bibitem(xml_bib_entries[intNumberOfEntry - 1]) - if bibEntry.fullauthorlastfirst()[0] == bibEntryPrevious.fullauthorlastfirst()[0]: - strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=True) + "

" - elif bibEntryPrevious.fullauthorlastfirst()[0] == bibEntry.fullauthorlastfirst()[0]: - strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=True) + "

" - elif bibEntry.fullauthorlastfirst()[0] == bibEntryPrevious.fullauthorlastfirst()[0]: - strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=True) + "

" - else: - strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=False) + "

" - - xmlNew = etree.fromstring(strNewentry) - # next one writes the bibliography into the document - # xmlBibliography.append(xmlNew) - - intNumberOfEntry += 1 + # xml_bib_entries = xmlBibTree.findall(".//entry") + # intNumberOfEntry = 0 + # for xmlEntry in xml_bib_entries: + # if intNumberOfEntry == 0: + # # Don't check for previous author if first entry of the Bibliography + # bibEntry = Bibitem(xmlEntry) + # strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=False) + "

" + # else: + # bibEntry = Bibitem(xmlEntry) + # # Check if author of previous Entry is the same + # bibEntryPrevious = Bibitem(xml_bib_entries[intNumberOfEntry - 1]) + # if bibEntry.fullauthorlastfirst()[0] == bibEntryPrevious.fullauthorlastfirst()[0]: + # strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=True) + "

" + # elif bibEntryPrevious.fullauthorlastfirst()[0] == bibEntry.fullauthorlastfirst()[0]: + # strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=True) + "

" + # elif bibEntry.fullauthorlastfirst()[0] == bibEntryPrevious.fullauthorlastfirst()[0]: + # strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=True) + "

" + # else: + # strNewentry = "

" + createBibEntryAuthorYear(bibEntry, boolSameAuthor=False) + "

" + + # xmlNew = etree.fromstring(strNewentry) + # # next one writes the bibliography into the document + # # xmlBibliography.append(xmlNew) + + # intNumberOfEntry += 1 ###################### # end of old version # ###################### @@ -1580,7 +1585,7 @@ def cleanup(): # Pickle the 'data' dictionary using the highest protocol available. pickle.dump(data_to_pickle, f, pickle.HIGHEST_PROTOCOL) -grep_command = "grep -A1 -B2 'argument of \\\EOAfn;' %s-tralics.log" % options.filename +grep_command = "grep -A1 -B2 'argument of \\\EOAfn' %s-tralics.log" % options.filename grep_command_arguments = shlex.split(grep_command) grep_result = subprocess.Popen(grep_command_arguments, stdout=subprocess.PIPE) grep_output = grep_result.stdout.read()