http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10319
Revision: 10319 Author: xqt Date: 2012-06-08 07:11:16 +0000 (Fri, 08 Jun 2012) Log Message: ----------- use config.line_separator and prevent null edits without any changes on the wiki e.g. for cosmetic changes.
Modified Paths: -------------- branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py =================================================================== --- branches/rewrite/pywikibot/textlib.py 2012-06-08 07:02:37 UTC (rev 10318) +++ branches/rewrite/pywikibot/textlib.py 2012-06-08 07:11:16 UTC (rev 10319) @@ -62,7 +62,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>'), @@ -528,8 +528,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
@@ -612,7 +612,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()
@@ -768,10 +768,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