From d841fffa300f872f2304a27ef627050773526dd2 Mon Sep 17 00:00:00 2001 From: kthoden Date: Wed, 27 May 2020 13:10:45 +0200 Subject: [PATCH] Remove some elements --- src/imxml2django.py | 4 ++-- src/imxml2epub.py | 4 ++-- src/utils/libeoaconvert.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/imxml2django.py b/src/imxml2django.py index 446dd19..8861c15 100755 --- a/src/imxml2django.py +++ b/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 @@ -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") ############################################################################ diff --git a/src/imxml2epub.py b/src/imxml2epub.py index e27d16a..cc16da8 100755 --- a/src/imxml2epub.py +++ b/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. @@ -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") diff --git a/src/utils/libeoaconvert.py b/src/utils/libeoaconvert.py index e2aee8c..dc08bc2 100644 --- a/src/utils/libeoaconvert.py +++ b/src/utils/libeoaconvert.py @@ -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}"