summaryrefslogtreecommitdiff
path: root/wiki2text.py
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-03-06 00:13:37 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-03-06 00:13:37 +0200
commit6b699b060de765112fa03435b4afbd258262d1fb (patch)
tree940b584e5618a73215bc0a269f0c0a4ac718a74f /wiki2text.py
parenta8cd24f0f5cbefccdefd2a4a5166b89c6c8f7a54 (diff)
downloadwikitrans-6b699b060de765112fa03435b4afbd258262d1fb.tar.gz
wikitrans-6b699b060de765112fa03435b4afbd258262d1fb.tar.bz2
Lots of formatting kludges
Diffstat (limited to 'wiki2text.py')
-rw-r--r--wiki2text.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/wiki2text.py b/wiki2text.py
index 09bd86a..5fcd718 100644
--- a/wiki2text.py
+++ b/wiki2text.py
@@ -20,2 +20,3 @@ from types import TupleType
20from wikins import wiki_ns_re, wiki_ns 20from wikins import wiki_ns_re, wiki_ns
21import re
21import urllib 22import urllib
@@ -69,5 +70,13 @@ class TextWikiMarkup (WikiMarkup):
69 if len(elt[1]) > 1: 70 if len(elt[1]) > 1:
70 text = self.format(elt[1][1]) 71 s = map(self.format, elt[1])
72 text = s[1]
71 else: 73 else:
74 s = None
72 text = None 75 text = None
76
77 if s:
78 if s[0] == 'disambigR':
79 return ""
80 if len(s) > 1 and s[1] == 'thumb':
81 return ""
73 (qual,sep,tgt) = arg.partition(':') 82 (qual,sep,tgt) = arg.partition(':')
@@ -145,3 +154,3 @@ class TextWikiMarkup (WikiMarkup):
145 string += " " 154 string += " "
146 string += s.rstrip(" ") 155 string += s
147 else: 156 else:
@@ -158,3 +167,3 @@ class TextWikiMarkup (WikiMarkup):
158 if s: 167 if s:
159 string += " " + s.rstrip(" ") 168 string += " " + s
160 string = "_" + string.lstrip(" ") + "_" 169 string = "_" + string.lstrip(" ") + "_"
@@ -169,3 +178,3 @@ class TextWikiMarkup (WikiMarkup):
169 string += " " 178 string += " "
170 string += s.rstrip(" ") 179 string += s
171 string = string.upper() 180 string = string.upper()
@@ -174,3 +183,7 @@ class TextWikiMarkup (WikiMarkup):
174 elif elt[0] == TMPL: 183 elif elt[0] == TMPL:
175 string = '[' + self.fmtlink(elt, True) + ']' 184 s = self.fmtlink(elt, True)
185 if s:
186 string = '[' + s + ']'
187 else:
188 string = s
176 elif elt[0] == BAR: 189 elif elt[0] == BAR:
@@ -198,5 +211,5 @@ class TextWikiMarkup (WikiMarkup):
198 if type == ENVUNNUM: 211 if type == ENVUNNUM:
199 string += self.indent(lev, "- " + x.lstrip(" ")) 212 string += self.fmtpara(self.indent(lev, "- " + x.lstrip(" ")))
200 elif type == ENVNUM: 213 elif type == ENVNUM:
201 string += self.indent(lev, "%d. %s" % (n, x)) 214 string += self.fmtpara(self.indent(lev, "%d. %s" % (n, x)))
202 n += 1 215 n += 1

Return to:

Send suggestions and report system problems to the System administrator.