From 00cfd0d5bae2e7688754dfc458016d42abfcd037 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 14 Mar 2016 08:10:01 +0000 Subject: Add HTML AST with strip_empty function --- mammoth/html/nodes.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 mammoth/html/nodes.py (limited to 'mammoth/html/nodes.py') diff --git a/mammoth/html/nodes.py b/mammoth/html/nodes.py new file mode 100644 index 0000000..aae4888 --- /dev/null +++ b/mammoth/html/nodes.py @@ -0,0 +1,32 @@ +import cobble + + +class Node(object): + pass + + +@cobble.data +class TextNode(Node): + value = cobble.field() + + +@cobble.data +class Element(Node): + tag_names = cobble.field() + attributes = cobble.field() + children = cobble.field() + collapsible = cobble.field() + + +@cobble.data +class SelfClosingElement(Node): + tag_name = cobble.field() + attributes = cobble.field() + + +@cobble.visitable +class ForceWrite(Node): + pass + + +NodeVisitor = cobble.visitor(Node) -- cgit v1.2.3