diff options
-rw-r--r-- | wiki2text.py | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/wiki2text.py b/wiki2text.py index 5ed91fa..09bd86a 100644 --- a/wiki2text.py +++ b/wiki2text.py @@ -133,7 +133,7 @@ class TextWikiMarkup (WikiMarkup): length += wsc + wlen return output + linebuf - def fmtelt(self, elt, indent=0): + def format(self, elt): if elt[0] == TEXT: if isinstance(elt[1],list): string = "" @@ -204,19 +204,14 @@ class TextWikiMarkup (WikiMarkup): string += "\n" elif elt[0] == IND: string = (" " * elt[1]) + self.format(elt[2]) + '\n' - else: - string = str(elt) - return string - - def format(self, elt, indent=0): - if elt[0] == SEQ: + elif elt[0] == SEQ: string = "" for x in elt[1]: if len(string) > 1 and not string[-1].isspace(): string += ' ' - string += self.format(x, indent) + string += self.format(x) else: - string = self.fmtelt(elt, indent) + string = str(elt) return string def __str__(self): @@ -229,24 +224,5 @@ class TextWiktionaryMarkup (TextWikiMarkup): """ See documentation for HtmlWiktionaryMarkup """ + # FIXME: It is supposed to do something about templates - seq_pos = 0 - - def str_seq(self, tok, env): - s = "" - self.seq_pos=0 - for t in tok[1:]: - x = self.fmtok(t, env) - if x: - s += x - self.seq_pos += 1 - return s - - def str_tmpl(self, tok, env): - arg = self.fmtok(tok[1], env) - if arg and arg != '': - if self.seq_pos > 0: - return arg - else: - return "\n" + arg + ":\n" - |