invalid output from HTML converter parsing preformatted code, multiline paragraphs: part 2 of 2 fixes moin2 #516
authorRogerHaase <haaserd@gmail.com>
Tue, 14 Apr 2015 06:49:48 -0700
changeset 10597dc359ea3e2
parent 104 310ef85ca282
child 106 b7f55cf97425
invalid output from HTML converter parsing preformatted code, multiline paragraphs: part 2 of 2 fixes moin2 #516
emeraldtree/tree.py
     1.1 --- a/emeraldtree/tree.py	Sun May 19 22:48:15 2013 +0200
     1.2 +++ b/emeraldtree/tree.py	Tue Apr 14 06:49:48 2015 -0700
     1.3 @@ -916,7 +916,12 @@
     1.4      def _flush(self):
     1.5          if self._data:
     1.6              text = "".join(self._data)
     1.7 -            self._elem[-1].append(text)
     1.8 +            if self._elem:
     1.9 +                self._elem[-1].append(text)
    1.10 +            else:
    1.11 +                # ignore empty lines in input, typically strings like: "\n", "   \n", "\n\n\n", etc.
    1.12 +                text = text.strip()
    1.13 +                assert not text, 'Parsing error: cannot append orphan string to prior node.'
    1.14              self._data = []
    1.15  
    1.16      ##