diff options
-rw-r--r-- | wiki2html.py | 4 | ||||
-rw-r--r-- | wiki2texi.py | 4 | ||||
-rw-r--r-- | wiki2text.py | 4 | ||||
-rw-r--r-- | wikimarkup.py | 24 |
4 files changed, 18 insertions, 18 deletions
diff --git a/wiki2html.py b/wiki2html.py index f3ea0e3..10a3e1b 100644 --- a/wiki2html.py +++ b/wiki2html.py @@ -173,9 +173,7 @@ class HtmlWikiMarkup (WikiMarkup): return string def str_tag(self, elt): - if elt['tag'] == 'nowiki': - return '<pre>' + self.format(elt['content']) + '</pre>' - elif elt['tag'] == 'code': + if elt['tag'] == 'code': self.nested += 1 s = self.format(elt['content']) self.nested -= 1 diff --git a/wiki2texi.py b/wiki2texi.py index e9009ec..3d74f80 100644 --- a/wiki2texi.py +++ b/wiki2texi.py @@ -120,9 +120,7 @@ class TexiWikiMarkup (WikiMarkup): return str(elt) def str_tag(self, elt): - if elt['tag'] == 'nowiki': - return '@example\n' + self.format(elt['content']) + '@end example\n' - elif elt['tag'] == 'code': + if elt['tag'] == 'code': self.nested += 1 s = self.format(elt['content']) self.nested -= 1 diff --git a/wiki2text.py b/wiki2text.py index d4cab81..c92dbc0 100644 --- a/wiki2text.py +++ b/wiki2text.py @@ -143,9 +143,7 @@ class TextWikiMarkup (WikiMarkup): return output + linebuf def str_tag(self, elt): - if elt['tag'] == 'nowiki': - return self.format(elt['content']) - elif elt['tag'] == 'code': + if elt['tag'] == 'code': self.nested += 1 s = self.format(elt['content']) self.nested -= 1 diff --git a/wikimarkup.py b/wikimarkup.py index 0c6d2f2..815e89d 100644 --- a/wikimarkup.py +++ b/wikimarkup.py @@ -234,27 +234,33 @@ class BaseWikiMarkup(object): 'content': line[pos:] }) if t: + line = rest + pos = 0 if t['type'] == 'OTAG' and t['tag'] == 'nowiki': - s = '' - if not m.group('closed'): + if m.group('closed'): + pass + else: while 1: try: - l = self.input() - m = ctag.match(l) + m = ctag.match(line) if m and m.group('tag') == t['tag']: + yield({ 'type': 'TEXT', + 'content': m.group('pfx') }) + pos = m.end(0) break - s += l + + yield({ 'type': 'TEXT', + 'content': line }) + + line = self.input() except StopIteration: break - t['type'] = 'TAG' - t['content'] = {'type': 'TEXT', 'content': s} + continue yield(t) if t['type'] == 'OTAG' and m.group('closed'): t['type'] = 'CTAG' yield(t) - line = rest - pos = 0 else: line = None |