summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wikitrans/wikimarkup.py48
1 files changed, 25 insertions, 23 deletions
diff --git a/wikitrans/wikimarkup.py b/wikitrans/wikimarkup.py
index d199335..0ce0e15 100644
--- a/wikitrans/wikimarkup.py
+++ b/wikitrans/wikimarkup.py
@@ -185,31 +185,10 @@ class WikiMarkupParser(object):
print("[DEBUG] %s" % l)
inline_delims = [ "''", "'''", "[", "]", "[[", "]]", "{{", "}}", "|" ]
- token_class = {
- 'NIL': WikiNode,
- 'NL': WikiNode,
- 'OTAG': WikiTagNode,
- 'CTAG': WikiTagNode,
- 'TAG': WikiTagNode,
- 'DELIM': WikiDelimNode,
- 'TEXT': WikiTextNode,
- 'PRE': WikiContentNode,
- 'PARA': WikiSeqNode,
- 'BAR': WikiNode,
- 'SEQ': WikiSeqNode,
- 'IND': WikiIndNode,
- 'REF': WikiRefNode,
- 'TMPL': WikiSeqNode,
- 'IT': WikiSeqNode,
- 'BOLD': WikiSeqNode,
- 'ELT': WikiEltNode,
- 'ENV': WikiEnvNode,
- 'LINK': WikiSeqNode,
- 'HDR': WikiHdrNode
- }
-
+ token_class = {}
+
def _new_node(self, **kwarg):
return self.token_class[kwarg['type']](self, **kwarg)
def tokread(self):
@@ -991,8 +970,31 @@ class WikiMarkup(WikiMarkupParser):
media_base=URL
Base URL for media files. Default is
'http://www.mediawiki.org/xml/export-0.3'
"""
+ self.token_class = {
+ 'NIL': WikiNode,
+ 'NL': WikiNode,
+ 'OTAG': WikiTagNode,
+ 'CTAG': WikiTagNode,
+ 'TAG': WikiTagNode,
+ 'DELIM': WikiDelimNode,
+ 'TEXT': WikiTextNode,
+ 'PRE': WikiContentNode,
+ 'PARA': WikiSeqNode,
+ 'BAR': WikiNode,
+ 'SEQ': WikiSeqNode,
+ 'IND': WikiIndNode,
+ 'REF': WikiRefNode,
+ 'TMPL': WikiSeqNode,
+ 'IT': WikiSeqNode,
+ 'BOLD': WikiSeqNode,
+ 'ELT': WikiEltNode,
+ 'ENV': WikiEnvNode,
+ 'LINK': WikiSeqNode,
+ 'HDR': WikiHdrNode
+ }
+
for kw in keywords:
if kw == 'file':
self.file = keywords[kw]
elif kw == 'filename':

Return to:

Send suggestions and report system problems to the System administrator.