Skip to content

Commit

Permalink
Remove some empty tags
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Jul 9, 2021
1 parent 7293c43 commit a4f47b9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/imxml2django.py
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,11 @@ def bring_footnote_down_django(footnote, fragment, footnote_number, object_numbe
collagelinks = xmlDjangoTree.xpath(".//a[@type='collage']/originalcontents/a")
for link in collagelinks:
link.tag = "temp"

some_empty_tags = xmlDjangoTree.xpath(".//anchor[not(node())] | .//b[not(node())]")
for tag in some_empty_tags:
tag.tag = "tagtobestripped"

etree.strip_tags(xmlDjangoTree, "temp", "citetext", "EOAprintbibliography", "originalcontents", "tagtobestripped")
etree.strip_elements(xmlDjangoTree, "citekey", "elementtoberemoved", with_tail=False)
etree.strip_attributes(xmlDjangoTree, "id-text", "id", "noindent", "type", "label", "spacebefore")#, "rend")
Expand Down

0 comments on commit a4f47b9

Please sign in to comment.