summaryrefslogtreecommitdiff
path: root/wiki2html.py
diff options
context:
space:
mode:
Diffstat (limited to 'wiki2html.py')
-rw-r--r--wiki2html.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/wiki2html.py b/wiki2html.py
index eee592d..061377b 100644
--- a/wiki2html.py
+++ b/wiki2html.py
@@ -172,12 +172,38 @@ class HtmlWikiMarkup (WikiMarkup):
self.envt[type]["hdr"])
return string
+ supported_tags = [ 'nowiki', 'code' ]
+ def input_tag(self, tag):
+ return tag['tag'] in self.supported_tags
+
+ def str_tag(self, elt):
+ if elt['tag'] == 'nowiki':
+ return '<pre>' + elt['content'] + '</pre>'
+ elif elt['tag'] == 'code':
+ kwdict = {
+ 'nested': self.nested + 1,
+ 'lang': self.lang,
+ 'text': elt['content'],
+ 'html_base': self.html_base,
+ 'image_base': self.image_base,
+ 'media_base': self.media_base }
+ markup = HtmlWiktionaryMarkup(**kwdict)
+ markup.debug_level = self.debug_level
+ markup.parse()
+ return '<pre><code>' + str(markup) + '</code></pre>' #FIXME
+
def str_para(self, elt):
string = "";
for x in elt['content']:
string += self.format(x)
return "<p>" + string + "</p>"
+ def str_pre(self, elt):
+ string = "";
+ for x in elt['content']:
+ string += self.format(x)
+ return '<pre>' + string + '</pre>'
+
def str_ind(self, elt):
return ("&nbsp;" * 2 * elt['level']) + self.format(elt['content'])
@@ -190,8 +216,12 @@ class HtmlWikiMarkup (WikiMarkup):
else:
string = elt['content']
return string
+ elif elt['type'] == 'TAG':
+ return self.str_tag(elt)
elif elt['type'] == 'PARA':
return self.str_para(elt)
+ elif elt['type'] == 'PRE':
+ return self.str_pre(elt)
elif elt['type'] == 'IT':
return self.str_it(elt)
elif elt['type'] == 'BOLD':

Return to:

Send suggestions and report system problems to the System administrator.