Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove some elements
  • Loading branch information
kthoden committed May 27, 2020
1 parent c70d714 commit d841fff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/imxml2django.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2020-05-27 13:05:20 (kthoden)>
# Time-stamp: <2020-05-27 13:10:27 (kthoden)>

"""
Create an XML file that can be inserted into the Django database
Expand Down Expand Up @@ -1973,7 +1973,7 @@ def bring_footnote_down_django(footnote, fragment, footnote_number, object_numbe
for link in collagelinks:
link.tag = "temp"
etree.strip_tags(xmlDjangoTree, "temp", "citetext", "EOAprintbibliography", "originalcontents", "tagtobestripped")
etree.strip_elements(xmlDjangoTree, "citekey", "elementtobestripped", with_tail=False)
etree.strip_elements(xmlDjangoTree, "citekey", "elementtoberemoved", with_tail=False)
etree.strip_attributes(xmlDjangoTree, "id-text", "id", "noindent", "type", "label", "spacebefore")#, "rend")

############################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/imxml2epub.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# Time-stamp: <2020-05-27 11:07:24 (kthoden)>
# Time-stamp: <2020-05-27 13:09:21 (kthoden)>

""" Convert a customized DocBook XML file into a set of files that
constitute the contents of an EPUB file.
Expand Down Expand Up @@ -1839,7 +1839,7 @@ class FootnoteError(Exception):
xmlIndexentry.tail = tmpTail
etree.strip_tags(xmlEbookTree, "EOAlabel", "EOAindex", "EOApageref", "EOAcitenumeric", "EOAtable", "EOAref", "note", "div", "div2", "div3", "div4", "div5", "citetext", "newpage", "EOAciteyear", "EOAtablelabel" , "hi", "pagebreak", "page", "pagestyle", "EOAcitation", "EOAciteauthoryear", "EOAcitemanual", "EOAprintbibliography", "EOAindexperson", "EOAprintindex", "EOAindexlocation", "EOAprintpersonindex", "EOAprintlocationindex","anchor", "temp", "EOAletterhead", "EOAhifigure", "EOAtocentry","tagtobestripped")
etree.strip_attributes(xmlEbookTree, "id-text", "noindent", "type", "label", "spacebefore", "rend", "hielement") # also contained "id"
etree.strip_elements(xmlEbookTree, "citekey", "originalcontents", with_tail=False)
etree.strip_elements(xmlEbookTree, "citekey", "originalcontents", "elementtoberemoved", with_tail=False)

logging.info("Write every Part and Chapter into one file")
xmlChapters = xmlEbookTree.findall("//div1")
Expand Down
2 changes: 1 addition & 1 deletion src/utils/libeoaconvert.py
Expand Up @@ -506,7 +506,7 @@ def format_hyperlinks_django_epub(xmlHyperlink, strLanguage):
accessed_date = accessed_date_element.get("when")
formatted_date = format_date(accessed_date, two_letter_language(strLanguage))
# etree.strip_elements(accessed_date_element, with_tail=True)
accessed_date_element.tag = "elementtobestripped"
accessed_date_element.tag = "elementtoberemoved"
accessed_date_element.tail = ""
url_tail = xmlHyperlink.tail
xmlHyperlink.tail = f", {formatted_date}{url_tail}"
Expand Down

0 comments on commit d841fff

Please sign in to comment.