diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2015-07-05 14:13:45 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2015-07-05 14:18:07 +0300 |
commit | 729f5a4e4ad71ff62d56cae2336738d65dc574f9 (patch) | |
tree | 2e66ad09adf70c299d64eba158f68c8ef43e0268 /wiki2text.py | |
parent | a8d15328a95bc16c3d9f4ca06c0c69767899f678 (diff) | |
download | wit-729f5a4e4ad71ff62d56cae2336738d65dc574f9.tar.gz wit-729f5a4e4ad71ff62d56cae2336738d65dc574f9.tar.bz2 |
Fix most testcases.
* wikimarkup.py (envtypes): Redo as a dictionary.
(ELT): New item type
(BaseWikiMarkup): Fix list parsing.
(parse): Comment out changes introduced by 9c42879.
Must be rewritten.
* wiki2html.py (HtmlWikiMarkup): Change handling of lists.
* wiki2text.py: Likewise.
* testdata/deflist.wiki: New testcase.
* testdata/deflist.html: Likewise.
* testdata/colon.html: Update.
* testdata/headings.html: Update.
* testdata/hz.html: Update.
* testdata/numlist.html: Update.
* testdata/unlist.html: Update.
Diffstat (limited to 'wiki2text.py')
-rw-r--r-- | wiki2text.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/wiki2text.py b/wiki2text.py index 0f8dd5f..005e551 100644 --- a/wiki2text.py +++ b/wiki2text.py @@ -207,12 +207,18 @@ class TextWikiMarkup (WikiMarkup): for s in elt[3]: if not string.endswith("\n"): string += "\n" - x = self.format(s) - if type == ENVUNNUM: + x = self.format(s[2]) + if type == "unnumbered": string += self.fmtpara(self.indent(lev, "- " + x.lstrip(" "))) - elif type == ENVNUM: + elif type == "numbered": string += self.fmtpara(self.indent(lev, "%d. %s" % (n, x))) n += 1 + elif type == "defn": + if s[1] == 0: + string += self.indent(lev-1, x) + else: + string += self.indent(lev+3, x) + if not string.endswith("\n"): string += "\n" elif elt[0] == IND: |