diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-17 16:18:33 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-17 16:18:33 +0300 |
commit | dd481f6030fe140fa3e321cfe08a38f53e549aed (patch) | |
tree | 9b2455d14ee2aec0ad455f1c5c2eb22f4d2a7ad5 | |
parent | eaf9325ddcff786f3fcd5b9047327ef6e397e778 (diff) | |
download | wit-dd481f6030fe140fa3e321cfe08a38f53e549aed.tar.gz wit-dd481f6030fe140fa3e321cfe08a38f53e549aed.tar.bz2 |
Bugfixes
* WikiTrans/wikimarkup.py (tokread): Fix recognition of <nowiki>
blocks and unhandled tags.
* tests/test.py: Minor fix.
-rw-r--r-- | WikiTrans/wikimarkup.py | 6 | ||||
-rw-r--r-- | tests/test.py | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/WikiTrans/wikimarkup.py b/WikiTrans/wikimarkup.py index 2ef6be1..bccd73e 100644 --- a/WikiTrans/wikimarkup.py +++ b/WikiTrans/wikimarkup.py @@ -255,7 +255,7 @@ class BaseWikiMarkup(object): if not m.group('closed'): while 1: try: - m = self.ctag.match(line) + m = self.ctag.search(line, pos) if m and m.group('tag') == 'nowiki': yield({ 'type': 'TEXT', 'content': line[pos:m.start(0)] }) @@ -283,6 +283,10 @@ class BaseWikiMarkup(object): yield({'type': 'TEXT', 'content': m.group(0)}) continue + else: + yield({ 'type': 'TEXT', + 'content': m.group(0) }) + continue else: m = self.ctag.match(line, pos) if m: diff --git a/tests/test.py b/tests/test.py index 9c72832..cde21bc 100644 --- a/tests/test.py +++ b/tests/test.py @@ -17,7 +17,7 @@ from __future__ import print_function import unittest -import wiki2html +from WikiTrans.wiki2html import HtmlWikiMarkup, HtmlWiktionaryMarkup class TestMarkupParserBasic (unittest.TestCase): @@ -95,7 +95,7 @@ class TestMarkupParserBasic (unittest.TestCase): fh = open(name_out) buf = ''.join(fh.readlines()).strip() fh.close() - hwm = wiki2html.HtmlWiktionaryMarkup(filename=name_in, lang="pl") + hwm = HtmlWiktionaryMarkup(filename=name_in, lang="pl") hwm.parse() if str(hwm).strip() == buf: |