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):
185 print("[DEBUG] %s" % l) 185 print("[DEBUG] %s" % l)
186 186
187 inline_delims = [ "''", "'''", "[", "]", "[[", "]]", "{{", "}}", "|" ] 187 inline_delims = [ "''", "'''", "[", "]", "[[", "]]", "{{", "}}", "|" ]
188 188
189 token_class = { 189 token_class = {}
190 'NIL': WikiNode, 190
191 'NL': WikiNode,
192 'OTAG': WikiTagNode,
193 'CTAG': WikiTagNode,
194 'TAG': WikiTagNode,
195 'DELIM': WikiDelimNode,
196 'TEXT': WikiTextNode,
197 'PRE': WikiContentNode,
198 'PARA': WikiSeqNode,
199 'BAR': WikiNode,
200 'SEQ': WikiSeqNode,
201 'IND': WikiIndNode,
202 'REF': WikiRefNode,
203 'TMPL': WikiSeqNode,
204 'IT': WikiSeqNode,
205 'BOLD': WikiSeqNode,
206 'ELT': WikiEltNode,
207 'ENV': WikiEnvNode,
208 'LINK': WikiSeqNode,
209 'HDR': WikiHdrNode
210 }
211
212 def _new_node(self, **kwarg): 191 def _new_node(self, **kwarg):
213 return self.token_class[kwarg['type']](self, **kwarg) 192 return self.token_class[kwarg['type']](self, **kwarg)
214 193
215 def tokread(self): 194 def tokread(self):
@@ -991,8 +970,31 @@ class WikiMarkup(WikiMarkupParser):
991 media_base=URL 970 media_base=URL
992 Base URL for media files. Default is 971 Base URL for media files. Default is
993 'http://www.mediawiki.org/xml/export-0.3' 972 'http://www.mediawiki.org/xml/export-0.3'
994 """ 973 """
974 self.token_class = {
975 'NIL': WikiNode,
976 'NL': WikiNode,
977 'OTAG': WikiTagNode,
978 'CTAG': WikiTagNode,
979 'TAG': WikiTagNode,
980 'DELIM': WikiDelimNode,
981 'TEXT': WikiTextNode,
982 'PRE': WikiContentNode,
983 'PARA': WikiSeqNode,
984 'BAR': WikiNode,
985 'SEQ': WikiSeqNode,
986 'IND': WikiIndNode,
987 'REF': WikiRefNode,
988 'TMPL': WikiSeqNode,
989 'IT': WikiSeqNode,
990 'BOLD': WikiSeqNode,
991 'ELT': WikiEltNode,
992 'ENV': WikiEnvNode,
993 'LINK': WikiSeqNode,
994 'HDR': WikiHdrNode
995 }
996
995 for kw in keywords: 997 for kw in keywords:
996 if kw == 'file': 998 if kw == 'file':
997 self.file = keywords[kw] 999 self.file = keywords[kw]
998 elif kw == 'filename': 1000 elif kw == 'filename':

Return to:

Send suggestions and report system problems to the System administrator.