From 8661cad2a82b66254fff564f4a514cbd67ad371d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 10 Dec 2016 22:01:20 +0000 Subject: Remove self-closing elements from AST --- mammoth/html/nodes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'mammoth/html/nodes.py') 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 -- cgit v1.2.3