MoinLight

Change of moinformat/tree.py

12:575c7b5d97ac
moinformat/tree.py
     1.1 --- a/moinformat/tree.py	Sat Apr 29 17:47:03 2017 +0200
     1.2 +++ b/moinformat/tree.py	Sat Apr 29 18:20:55 2017 +0200
     1.3 @@ -159,7 +159,32 @@
     1.4              node.to_string(out)
     1.5          out.end_listitem()
     1.6  
     1.7 -class Text:
     1.8 +
     1.9 +
    1.10 +class Node:
    1.11 +
    1.12 +    "A document node without children."
    1.13 +
    1.14 +    def empty(self):
    1.15 +        return False
    1.16 +
    1.17 +class Rule(Node):
    1.18 +
    1.19 +    "A horizontal rule."
    1.20 +
    1.21 +    def __init__(self, length):
    1.22 +        self.length = length
    1.23 +
    1.24 +    def __repr__(self):
    1.25 +        return "Rule(%d)" % self.length
    1.26 +
    1.27 +    def prettyprint(self, indent=""):
    1.28 +        return "%sRule: %d" % (indent, self.length)
    1.29 +
    1.30 +    def to_string(self, out):
    1.31 +        out.rule(self.length)
    1.32 +
    1.33 +class Text(Node):
    1.34  
    1.35      "A text node."
    1.36