aboutsummaryrefslogtreecommitdiff
path: root/mammoth/html/nodes.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-12-10 22:01:20 +0000
committerMichael Williamson <mike@zwobble.org>2016-12-10 22:01:20 +0000
commit8661cad2a82b66254fff564f4a514cbd67ad371d (patch)
tree83cf43f5127b7e93575f3fd40ddeb8a1f41e7ee2 /mammoth/html/nodes.py
parentb870478788c35f9aa7902977938f253197b6d6d8 (diff)
Remove self-closing elements from AST
Diffstat (limited to 'mammoth/html/nodes.py')
-rw-r--r--mammoth/html/nodes.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/mammoth/html/nodes.py b/mammoth/html/nodes.py
index ff31c8c..9c07259 100644
--- a/mammoth/html/nodes.py
+++ b/mammoth/html/nodes.py
@@ -47,11 +47,10 @@ class Element(Node):
def separator(self):
return self.tag.separator
+ _VOID_TAG_NAMES = set(["br", "hr", "img"])
-@cobble.data
-class SelfClosingElement(Node):
- tag_name = cobble.field()
- attributes = cobble.field()
+ def is_void(self):
+ return not self.children and self.tag_name in self._VOID_TAG_NAMES
@cobble.visitable