Revision: 4213 Author: wikipedian Date: 2007-09-08 00:50:29 +0000 (Sat, 08 Sep 2007)
Log Message: ----------- place spaces after bullet in lists/enumerations
Modified Paths: -------------- trunk/pywikipedia/cosmetic_changes.py
Modified: trunk/pywikipedia/cosmetic_changes.py =================================================================== --- trunk/pywikipedia/cosmetic_changes.py 2007-09-08 00:50:06 UTC (rev 4212) +++ trunk/pywikipedia/cosmetic_changes.py 2007-09-08 00:50:29 UTC (rev 4213) @@ -85,6 +85,7 @@ text = self.standardizeCategories(text) text = self.cleanUpLinks(text) text = self.cleanUpSectionHeaders(text) + text = self.putSpacesInLists(text) text = self.translateAndCapitalizeNamespaces(text) text = self.removeDeprecatedTemplates(text) text = self.resolveHtmlEntities(text) @@ -280,11 +281,32 @@ return text
def cleanUpSectionHeaders(self, text): + """ + For better readability of section header source code, puts a space + between the equal signs and the title. + Example: ==Section title== becomes == Section title == + + NOTE: This space is recommended in the syntax help on the English and + German Wikipedia. It might be that it is not wanted on other wikis. + If there are any complaints, please file a bug report. + """ for level in range(1, 7): equals = '=' * level text = wikipedia.replaceExcept(text, r'\n' + equals + ' *(?P<title>[^=]+?) *' + equals + ' *\r\n', '\n' + equals + ' \g<title> ' + equals + '\r\n', ['comment', 'math', 'nowiki', 'pre']) return text
+ def putSpacesInLists(self, text): + """ + For better readability of bullet list and enumeration wiki source code, + puts a space between the * or # and the text. + + NOTE: This space is recommended in the syntax help on the English, German, + and French Wikipedia. It might be that it is not wanted on other wikis. + If there are any complaints, please file a bug report. + """ + text = wikipedia.replaceExcept(text, r'(?m)^(?P<bullet>(*+|#+):*)(?P<char>[^\s*#:].+?)', '\g<bullet> \g<char>', ['comment', 'math', 'nowiki', 'pre']) + return text + def removeDeprecatedTemplates(self, text): if deprecatedTemplates.has_key(self.site.family.name) and deprecatedTemplates[self.site.family.name].has_key(self.site.lang): for template in deprecatedTemplates[self.site.family.name][self.site.lang]: