changeset 5:cd6792e396f5

fix spacing in multi-line block elements
author sheep@ghostwheel
date Fri, 17 Apr 2009 00:19:11 +0200
parents 8a907c2a2aa6
children c4619fedabbb
files creole.py creole2html.py
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/creole.py	Thu Apr 16 22:00:33 2009 +0200
+++ b/creole.py	Fri Apr 17 00:19:11 2009 +0200
@@ -259,13 +259,16 @@
     _head_text_repl = _head_repl
 
     def _text_repl(self, groups):
+        text = groups.get('text', '')+u' '
         if self.cur.kind in ('table', 'table_row', 'bullet_list',
             'number_list'):
             self.cur = self._upto(self.cur,
                 ('document', 'section', 'blockquote'))
-        if self.cur.kind in ('document', 'section', 'blockquote'):
+        elif self.cur.kind in ('document', 'section', 'blockquote'):
             self.cur = DocNode('paragraph', self.cur)
-        self.parse_inline(groups.get('text', '')+' ')
+        else:
+            text = u' ' + text
+        self.parse_inline(text)
         if groups.get('break') and self.cur.kind in ('paragraph',
             'emphasis', 'strong', 'code'):
             DocNode('break', self.cur, '')
--- a/creole2html.py	Thu Apr 16 22:00:33 2009 +0200
+++ b/creole2html.py	Fri Apr 17 00:19:11 2009 +0200
@@ -55,8 +55,7 @@
 <p>test</p>
 <ul>
     <li>test line one</li>
-    <li>test line two
-        test</li>
+    <li>test line two test</li>
 </ul>
 <p>test</p>