Revision: 5740 Author: leogregianin Date: 2008-07-19 04:06:55 +0000 (Sat, 19 Jul 2008)
Log Message: ----------- fixed bug 188064 - Collision of commandline arguments
Modified Paths: -------------- trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/replace.py =================================================================== --- trunk/pywikipedia/replace.py 2008-07-19 04:03:18 UTC (rev 5739) +++ trunk/pywikipedia/replace.py 2008-07-19 04:06:55 UTC (rev 5740) @@ -18,7 +18,7 @@
Furthermore, the following command line parameters are supported:
--regex Make replacements using regular expressions. If this argument +-useregex Make replacements using regular expressions. If this argument isn't given, the bot will make simple text replacements.
-nocase Use case insensitive regular expressions. @@ -29,16 +29,16 @@
-addcat:cat_name Adds "cat_name" category to every altered page.
--excepttitle:XYZ Skip pages with titles that contain XYZ. If the -regex +-excepttitle:XYZ Skip pages with titles that contain XYZ. If the -useregex argument is given, XYZ will be regarded as a regular expression.
--excepttext:XYZ Skip pages which contain the text XYZ. If the -regex +-excepttext:XYZ Skip pages which contain the text XYZ. If the -useregex argument is given, XYZ will be regarded as a regular expression.
-exceptinside:XYZ Skip occurences of the to-be-replaced text which lie - within XYZ. If the -regex argument is given, XYZ will be + within XYZ. If the -useregex argument is given, XYZ will be regarded as a regular expression.
-exceptinsidetag:XYZ Skip occurences of the to-be-replaced text which lie @@ -57,7 +57,7 @@ -fix:XYZ Perform one of the predefined replacements tasks, which are given in the dictionary 'fixes' defined inside the file fixes.py. - The -regex and -nocase argument and given replacements will + The -useregex and -nocase argument and given replacements will be ignored if you use -fix. Currently available predefined fixes are: &fixes-help; @@ -77,7 +77,7 @@ Be careful, this might lead to an infinite loop.
other: First argument is the old text, second argument is the new - text. If the -regex argument is given, the first argument + text. If the -useregex argument is given, the first argument will be regarded as a regular expression, and the second argument might contain expressions like \1 or \g<name>.
@@ -87,7 +87,7 @@ new syntax, e.g. {{Stub}}, download an XML dump file (pages-articles) from http://download.wikimedia.org, then use this command:
- python replace.py -xml -regex "{{msg:(.*?)}}" "{{\1}}" + python replace.py -xml -useregex "{{msg:(.*?)}}" "{{\1}}"
If you have a dump called foobar.xml and want to fix typos in articles, e.g. Errror -> Error, use this: @@ -490,7 +490,7 @@
# Read commandline parameters. for arg in wikipedia.handleArgs(): - if arg == '-regex': + if arg == '-useregex': regex = True elif arg.startswith('-xmlstart'): if len(arg) == 9:
I reverted that change in revision r5741 : the "regex" name is very unclear for pagegenerators.py, while "titleregex" is exactly what we're doing : matching a regex against titles.
I also believe that -regex in replace.py was used much more than -regex in pagegenerators.py; I'm trying here to reduce the inconvenience induced by that necessary change
2008/7/19 leogregianin@svn.wikimedia.org:
Revision: 5740 Author: leogregianin Date: 2008-07-19 04:06:55 +0000 (Sat, 19 Jul 2008)
Log Message:
fixed bug 188064 - Collision of commandline arguments
Modified Paths:
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/replace.py
--- trunk/pywikipedia/replace.py 2008-07-19 04:03:18 UTC (rev 5739) +++ trunk/pywikipedia/replace.py 2008-07-19 04:06:55 UTC (rev 5740) @@ -18,7 +18,7 @@
Furthermore, the following command line parameters are supported:
--regex Make replacements using regular expressions. If this argument +-useregex Make replacements using regular expressions. If this argument isn't given, the bot will make simple text replacements.
-nocase Use case insensitive regular expressions. @@ -29,16 +29,16 @@
-addcat:cat_name Adds "cat_name" category to every altered page.
--excepttitle:XYZ Skip pages with titles that contain XYZ. If the -regex +-excepttitle:XYZ Skip pages with titles that contain XYZ. If the -useregex argument is given, XYZ will be regarded as a regular expression.
--excepttext:XYZ Skip pages which contain the text XYZ. If the -regex +-excepttext:XYZ Skip pages which contain the text XYZ. If the -useregex argument is given, XYZ will be regarded as a regular expression.
-exceptinside:XYZ Skip occurences of the to-be-replaced text which lie
within XYZ. If the -regex argument is given, XYZ will be
within XYZ. If the -useregex argument is given, XYZ will be regarded as a regular expression.
-exceptinsidetag:XYZ Skip occurences of the to-be-replaced text which lie @@ -57,7 +57,7 @@ -fix:XYZ Perform one of the predefined replacements tasks, which are given in the dictionary 'fixes' defined inside the file fixes.py.
The -regex and -nocase argument and given replacements will
The -useregex and -nocase argument and given replacements will be ignored if you use -fix. Currently available predefined fixes are:
&fixes-help; @@ -77,7 +77,7 @@ Be careful, this might lead to an infinite loop.
other: First argument is the old text, second argument is the new
text. If the -regex argument is given, the first argument
text. If the -useregex argument is given, the first argument will be regarded as a regular expression, and the second argument might contain expressions like \\1 or \g<name>.
@@ -87,7 +87,7 @@ new syntax, e.g. {{Stub}}, download an XML dump file (pages-articles) from http://download.wikimedia.org, then use this command:
- python replace.py -xml -regex "{{msg:(.*?)}}" "{{\1}}"
- python replace.py -xml -useregex "{{msg:(.*?)}}" "{{\1}}"
If you have a dump called foobar.xml and want to fix typos in articles, e.g. Errror -> Error, use this: @@ -490,7 +490,7 @@
# Read commandline parameters. for arg in wikipedia.handleArgs():
if arg == '-regex':
if arg == '-useregex': regex = True elif arg.startswith('-xmlstart'): if len(arg) == 9:
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l