diff options
Diffstat (limited to 'wikimarkup.py')
-rw-r--r-- | wikimarkup.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/wikimarkup.py b/wikimarkup.py index 9a79d1e..0c6d2f2 100644 --- a/wikimarkup.py +++ b/wikimarkup.py @@ -186,10 +186,19 @@ class BaseWikiMarkup(object): if m and line[m.start(0)] != '<': - if m.group(0)[0] in envtypes and pos < len(line) and line[pos] == ":": - yield({ 'type': 'DELIM', - 'content': m.group(0), - 'continuation': True }) - pos += 1 + content = m.group(0) + if content[0] in envtypes: + t = { 'type': 'DELIM', + 'content': content, + 'continuation': pos < len(line) and line[pos] == ":" } + if t['continuation']: + t['content'] += t['content'][0] + pos += 1 + + yield(t) + + while pos < len(line) and line[pos] in [' ', '\t']: + pos += 1 else: yield({ 'type': 'DELIM', - 'content': m.group(0) }) + 'content': content, + 'continuation': False}) else: @@ -307,4 +316,4 @@ class BaseWikiMarkup(object): - def peektkn(self): - return self.toklist[self.tokind] + def peektkn(self, off=0): + return self.toklist[self.tokind-off] @@ -606,3 +615,3 @@ class BaseWikiMarkup(object): elt = self.parse_line() - if 'continuation' not in tok: + if not tok['continuation']: list.append({ 'type': 'ELT', @@ -683,6 +692,8 @@ class BaseWikiMarkup(object): lev = len(tok['content']) + if tok['content'][0] == ':': + t = self.peektkn(2) + if not (t['type'] == 'DELIM' and t['content'] == ';'): + return self.parse_indent(lev) self.ungetkn() return self.parse_env(type, lev) - elif tok['content'][0] == ":": - return self.parse_indent(len(tok['content'])) else: |