From 34a58287efe597e2c007ebc47976929884ed60f7 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 10 Dec 2010 23:30:55 +0100 Subject: wikihelp: Avoid unnecessary empty lines (causing additional paragraphs). --- helpcontent2/to-wiki/wikiconv2.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'helpcontent2/to-wiki') diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py index 74b3f31362..a2acb9424e 100755 --- a/helpcontent2/to-wiki/wikiconv2.py +++ b/helpcontent2/to-wiki/wikiconv2.py @@ -1048,30 +1048,31 @@ class Paragraph(ElementBase): else: role = 'tablenextpara' - # prepend the markup according to the role - text = '' - if len(self.objects) > 0: - try: - text = text + replace_paragraph_role['start'][role] - except: - sys.stderr.write( "Unknown paragraph role start: " + role + "\n" ) - # the text itself children = ElementBase.get_all(self) if self.role != 'emph': children = children.strip() + if len(children) == 0: + return '' + + # prepend the markup according to the role + text = '' + try: + text = text + replace_paragraph_role['start'][role] + except: + sys.stderr.write( "Unknown paragraph role start: " + role + "\n" ) + if replace_paragraph_role['templ'][role]: text = text + escape_equals_sign(children) else: text = text + children # append the markup according to the role - if len(self.objects) > 0: - try: - text = text + replace_paragraph_role['end'][role] - except: - sys.stderr.write( "Unknown paragraph role end: " + role + "\n" ) + try: + text = text + replace_paragraph_role['end'][role] + except: + sys.stderr.write( "Unknown paragraph role end: " + role + "\n" ) return text -- cgit