diff options
author | Jan Holesovsky <kendy@suse.cz> | 2010-11-26 11:48:12 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-11-26 11:48:12 +0100 |
commit | 634e1e7ebd1658cc3aa9954eb5057ecdf12fefd1 (patch) | |
tree | 14dadb76f924ecf586781b3bf2b4d3e7fd706b11 /helpcontent2/to-wiki | |
parent | 4c61129db43e2c32ba3f184aa85b3e9f369f3839 (diff) |
wikihelp: Improve the handling of leading/trailing whitespace in paragraphs.
Diffstat (limited to 'helpcontent2/to-wiki')
-rwxr-xr-x | helpcontent2/to-wiki/wikiconv2.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py index a3581fb247..1c7f253cbd 100755 --- a/helpcontent2/to-wiki/wikiconv2.py +++ b/helpcontent2/to-wiki/wikiconv2.py @@ -764,10 +764,13 @@ class SwitchInline(ElementBase): 'WRITER':'Writer', 'default':''} try: app = appls[i.case] - if app == '': - text = text + i.get_all() + all = i.get_all() + if all == '': + pass + elif app == '': + text = text + all else: - text = text + '{{OnlyIn%s|%s}}'% (app, i.get_all()) + text = text + '{{OnlyIn%s|%s}}'% (app, all) except: sys.stderr.write('Unhandled "%s" case in "appl" switchinline.\n'% \ i.case) @@ -958,7 +961,7 @@ class Paragraph(ElementBase): sys.stderr.write( "Unknown paragraph role start: " + role + "\n" ) # the text itself - text = text + ElementBase.get_all(self) #.strip() + text = text + ElementBase.get_all(self).strip() # append the markup according to the role if len(self.objects) > 0: @@ -977,7 +980,6 @@ class Variable(Paragraph): def __init__(self, attrs, parent, depth): Paragraph.__init__(self, attrs, parent, depth) self.name = 'variable' - self.role = 'null' self.id = attrs['id'] def get_variable(self, id): @@ -1074,8 +1076,12 @@ for title in titles: try: file = open(outfile,"r") except: - wikiconv2(infile,title[1].strip(),outfile) - continue + try: + wikiconv2(infile,title[1].strip(),outfile) + continue + except: + print 'Failed to convert "%s" into "%s".\n'% \ + (title[1].strip(), outfile) print "Warning: Skipping: "+infile+" > "+outfile file.close() |