Revision: 3975 Author: wikipedian Date: 2007-08-06 16:38:41 +0000 (Mon, 06 Aug 2007)
Log Message: ----------- moved docu to fixes.py
Modified Paths: -------------- trunk/pywikipedia/fixes.py trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/fixes.py =================================================================== --- trunk/pywikipedia/fixes.py 2007-08-06 16:38:08 UTC (rev 3974) +++ trunk/pywikipedia/fixes.py 2007-08-06 16:38:41 UTC (rev 3975) @@ -1,6 +1,19 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- """ File containing all standard fixes """ __version__ = '$Id$' + +help = """ + * HTML - Convert HTML tags to wiki syntax, and + fix XHTML. + * syntax - Try to fix bad wiki markup. Do not run + this in automatic mode, as the bot may + make mistakes. + * syntax-safe - Like syntax, but less risky, so you can + run this in automatic mode. + * case-de - fix upper/lower case errors in German + * grammar-de - fix grammar and typography in German +""" + fixes = { # These replacements will convert HTML to wiki syntax where possible, and # make remaining tags XHTML compliant.
Modified: trunk/pywikipedia/replace.py =================================================================== --- trunk/pywikipedia/replace.py 2007-08-06 16:38:08 UTC (rev 3974) +++ trunk/pywikipedia/replace.py 2007-08-06 16:38:41 UTC (rev 3975) @@ -30,10 +30,7 @@ The -regex argument and given replacements will be ignored if you use -fix. Currently available predefined fixes are: - * HTML - convert HTML tags to wiki syntax, and fix XHTML - * syntax - try to fix bad wiki markup. - * case-de - fix upper/lower case errors in German - * grammar-de - fix grammar and typography in German +&fixes-help; -namespace:n Number of namespace to process. The parameter can be used multiple times. It works in combination with all other parameters, except for the -start parameter. If you e.g. @@ -78,15 +75,16 @@ import sys, re import wikipedia, pagegenerators,catlib, config
+# Imports predefined replacements tasks from fixes.py +import fixes + # This is required for the text that is shown when you run this script # with the parameter -help. docuReplacements = { - '¶ms;': pagegenerators.parameterHelp + '¶ms;': pagegenerators.parameterHelp, + '&fixes-help;': fixes.help, }
-# Imports predefined replacements tasks from fixes.py -from fixes import fixes - __version__='$Id$'
# Summary messages in different languages @@ -392,9 +390,9 @@ else: # Perform one of the predefined actions. try: - fix = fixes[fix] + fix = fixes.fixes[fix] except KeyError: - wikipedia.output(u'Available predefined fixes are: %s' % fixes.keys()) + wikipedia.output(u'Available predefined fixes are: %s' % fixes.fixes.keys()) wikipedia.stopme() sys.exit() if fix.has_key('regex'):