aboutsummaryrefslogtreecommitdiff
path: root/wiki2texi.py
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2015-07-12 23:11:40 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2015-07-12 23:11:40 +0300
commit28072898f1bd9a925d73ac187d560198d6345524 (patch)
treea46d781fb85d9dda61fc8f68e0ba6ec43d60ce55 /wiki2texi.py
parent75672b57a2d63f01d00795fe8d661d1efe7b6e8d (diff)
downloadwit-28072898f1bd9a925d73ac187d560198d6345524.tar.gz
wit-28072898f1bd9a925d73ac187d560198d6345524.tar.bz2
Improve tag handling and debugging
* wikimarkup.py: Rewrite tag recognition. Implement dump method. * wikicvt.py: New options -D (--dump), and -t dump * wiki2html.py (input_tag): Remove method (str_tag): Change handling of tags * wiki2texi.py: Likewise. * wiki2text.py: Likewise.
Diffstat (limited to 'wiki2texi.py')
-rw-r--r--wiki2texi.py35
1 files changed, 17 insertions, 18 deletions
diff --git a/wiki2texi.py b/wiki2texi.py
index 7cc67bd..0b3eb77 100644
--- a/wiki2texi.py
+++ b/wiki2texi.py
@@ -119,28 +119,27 @@ class TexiWikiMarkup (WikiMarkup):
else:
return str(elt)
- 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 '@example\n' + elt['content'] + '@end example\n'
+ return '@example\n' + self.format(elt['content']) + '@end example\n'
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 = TexiWikiMarkup(**kwdict)
- markup.debug_level = self.debug_level
- markup.parse()
- s = str(markup)
+ self.nested += 1
+ s = self.format(elt['content'])
+ self.nested -= 1
if not s.endswith("\n"):
- s += "\n";
+ s += "\n"
return '@example\n' + s + '@end example\n'
+ elif elt['tag'] == 'tt':
+ self.nested += 1
+ s = self.format(elt['content'])
+ self.nested -= 1
+ return "@code{%s}" % s
+ else:
+ s = '<' + elt['tag']
+ if elt['args']:
+ s += ' ' + elt['args']
+ s += '>' + self.format(elt['content']) + '</' + elt['tag'] + '>'
+ return s
def str_para(self, elt):
string = "";
@@ -156,7 +155,7 @@ class TexiWikiMarkup (WikiMarkup):
return string
if not string.endswith("\n"):
string += "\n";
- return '@example\n' + string + '@end example\n'
+ return '\n@example\n' + string + '@end example\n'
def concat(self, eltlist):
string = ""

Return to:

Send suggestions and report system problems to the System administrator.