Skip to content

Commit

Permalink
ignore collapsed boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lk3r committed Mar 22, 2016
1 parent 73a27b7 commit 50fb3ae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mwlib/treecleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ def __init__(self, tree, save_reports=False, nesting_strictness='loose', status_
'Vorlage_Gesundheitshinweis',
'hatnote'
]
self.noDisplayClassMatches = [
'infobox collapsible collapsed',
]

# keys are nodes which can only have child nodes of types inside the valuelist.
# children of different classes are deleted
Expand Down Expand Up @@ -822,7 +825,9 @@ def _safeRemove(self, node, named_refs):
node.parent.removeChild(node)

def removeNoPrintNodes(self, node):
if (node.hasClassID(self.noDisplayClasses) or not node.visible) and node.parent:
if (node.hasClassID(self.noDisplayClasses) or
not node.visible
or node.attributes.get('class', '') in self.noDisplayClassMatches) and node.parent:
named_refs = self._getNamedRefs(node)
if named_refs:
self.report('removing child - keeping named reference', node)
Expand Down

0 comments on commit 50fb3ae

Please sign in to comment.