diff options
author | Jan Holesovsky <kendy@suse.cz> | 2010-11-12 00:26:25 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-11-12 00:28:02 +0100 |
commit | 1f2bcee68e3e28aea67ec3757704f0c5edb7f1c3 (patch) | |
tree | bedb564210cc3a2e5beef27d5d14fdb6d9b21817 /helpcontent2 | |
parent | dd730c31937e547dae1f49a7ff6814f0d62b6c60 (diff) |
wikihelp: Handle comments.
Diffstat (limited to 'helpcontent2')
-rwxr-xr-x | helpcontent2/to-wiki/wikiconv2.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/helpcontent2/to-wiki/wikiconv2.py b/helpcontent2/to-wiki/wikiconv2.py index c96a945428..a2bb51f841 100755 --- a/helpcontent2/to-wiki/wikiconv2.py +++ b/helpcontent2/to-wiki/wikiconv2.py @@ -209,6 +209,30 @@ class cbookmark: file.write(i.encode('ascii','replace')+"\n") file.close() +class ccomment: + def __init__(self, attrs, parent): + self.text = '' + self.parent = parent + + def start_element(self, name, attrs): + pass + + def end_element(self, name): + if name == 'comment': + self.parent.child_parsing = False + + def char_data(self, data): + self.text = self.text + data + + def get_all(self): + return "<!-- " + self.text + " -->" + + def print_all(self): + print self.get_all() + + def get_curobj(self): + return self + class cimage: def __init__(self, attrs, parent): self.src = attrs['src'] @@ -492,6 +516,10 @@ class cparagraph: # This shouldn't occur print "Warning: Unhandled bookmark content!!!" + if name == 'comment': + child = ccomment(attrs, self) + self.child_parsing = True + self.objects.append(child) global start_eles for n in start_eles: @@ -552,6 +580,8 @@ class cparagraph: for i in self.objects: try: raise i + except ccomment: + self.wikitext = self.wikitext + i.get_all() except ctext: self.wikitext = self.wikitext + i.wikitext except clink: |