http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10322
Revision: 10322 Author: xqt Date: 2012-06-08 07:29:39 +0000 (Fri, 08 Jun 2012) Log Message: ----------- update from rewrite r10316, r10319, r10321
Modified Paths: -------------- trunk/pywikipedia/family.py trunk/pywikipedia/pywikibot/textlib.py
Modified: trunk/pywikipedia/family.py =================================================================== --- trunk/pywikipedia/family.py 2012-06-08 07:20:40 UTC (rev 10321) +++ trunk/pywikipedia/family.py 2012-06-08 07:29:39 UTC (rev 10322) @@ -3649,7 +3649,7 @@ # one-after-another on a single line self.interwiki_on_one_line = [] # String used as separator between interwiki links and the text - self.interwiki_text_separator = '\r\n\r\n' + self.interwiki_text_separator = config.line_separator * 2
# Similar for category self.category_attop = [] @@ -3657,7 +3657,7 @@ # one-after-another on a single line self.category_on_one_line = [] # String used as separator between category links and the text - self.category_text_separator = '\r\n\r\n' + self.category_text_separator = config.line_separator * 2 # When both at the bottom should categories come after interwikilinks? self.categories_last = []
Modified: trunk/pywikipedia/pywikibot/textlib.py =================================================================== --- trunk/pywikipedia/pywikibot/textlib.py 2012-06-08 07:20:40 UTC (rev 10321) +++ trunk/pywikipedia/pywikibot/textlib.py 2012-06-08 07:29:39 UTC (rev 10322) @@ -7,7 +7,7 @@
""" # -# (C) Pywikipedia bot team, 2004-2011 +# (C) Pywikipedia bot team, 2004-2012 # # Distributed under the terms of the MIT license. # @@ -17,6 +17,7 @@ import wikipedia as pywikibot import re from HTMLParser import HTMLParser +import config
def unescape(s): """Replace escaped HTML-special characters by their originals""" @@ -60,7 +61,7 @@ exceptionRegexes = { 'comment': re.compile(r'(?s)<!--.*?-->'), # section headers - 'header': re.compile(r'\r\n=+.+=+ *\r\n'), + 'header': re.compile(r'\r?\n=+.+=+ *\r?\n'), # preformatted text 'pre': re.compile(r'(?ism)<pre>.*?</pre>'), 'source': re.compile(r'(?is)<source .*?</source>'), @@ -531,8 +532,8 @@ if insite.lang in insite.family.interwiki_on_one_line: sep = u' ' else: - sep = u'\r\n' - s=sep.join(s) + u'\r\n' + sep = config.line_separator + s=sep.join(s) + config.line_separator return s
@@ -614,7 +615,7 @@ marker=marker) if marker: #avoid having multiple linefeeds at the end of the text - text = re.sub('\s*%s' % re.escape(marker), '\r\n' + marker, + text = re.sub('\s*%s' % re.escape(marker), config.LS + marker, text.strip()) return text.strip()
@@ -770,10 +771,10 @@ if insite.category_on_one_line(): sep = ' ' else: - sep = '\r\n' + sep = config.line_separator # Some people don't like the categories sorted #catLinks.sort() - return sep.join(catLinks) + '\r\n' + return sep.join(catLinks) + config.line_separator
#--------------------------------------- # Functions dealing with external links
pywikipedia-svn@lists.wikimedia.org