[Pywikipedia-l] SVN: [5741] trunk/pywikipedia
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Sat Jul 19 09:27:54 UTC 2008
Revision: 5741
Author: nicdumz
Date: 2008-07-19 09:27:54 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
* Revert 5740
* Resolving the -regex arg collision by making pagegenerator's -regex -titleregex
* Removing inconsistent usage doc
Modified Paths:
--------------
trunk/pywikipedia/pagegenerators.py
trunk/pywikipedia/replace.py
Modified: trunk/pywikipedia/pagegenerators.py
===================================================================
--- trunk/pywikipedia/pagegenerators.py 2008-07-19 04:06:55 UTC (rev 5740)
+++ trunk/pywikipedia/pagegenerators.py 2008-07-19 09:27:54 UTC (rev 5741)
@@ -91,12 +91,12 @@
"-start:Template:!" will make the bot work on all pages
in the template namespace.
--prefixindex Work on pages commencing with a common prefix. Argument
- may also be given as "-prefixindex:namespace:pagename".
+-prefixindex Work on pages commencing with a common prefix.
--regex Work on pages found by a regular expression. Argument
- may also be given as "-prefixindex:regularexpression".
+-regex Obsolete, use -titleregex
+-titleregex Work on titles that match the given regular expression.
+
-transcludes Work on all pages that use a certain template.
Argument can also be given as "-transcludes:Template:Title".
@@ -953,7 +953,7 @@
gen = SearchPageGenerator(mediawikiQuery, namespaces = [])
elif arg.startswith('-google'):
gen = GoogleSearchPageGenerator(arg[8:])
- elif arg.startswith('-regex'):
+ elif arg.startswith('-titleregex'):
if len(arg) == 6:
regex = wikipedia.input(u'What page names are you looking for?')
else:
Modified: trunk/pywikipedia/replace.py
===================================================================
--- trunk/pywikipedia/replace.py 2008-07-19 04:06:55 UTC (rev 5740)
+++ trunk/pywikipedia/replace.py 2008-07-19 09:27:54 UTC (rev 5741)
@@ -18,7 +18,7 @@
Furthermore, the following command line parameters are supported:
--useregex Make replacements using regular expressions. If this argument
+-regex 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 -useregex
+-excepttitle:XYZ Skip pages with titles that contain XYZ. If the -regex
argument is given, XYZ will be regarded as a regular
expression.
--excepttext:XYZ Skip pages which contain the text XYZ. If the -useregex
+-excepttext:XYZ Skip pages which contain the text XYZ. If the -regex
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 -useregex argument is given, XYZ will be
+ within XYZ. If the -regex 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 -useregex and -nocase argument and given replacements will
+ The -regex 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 -useregex argument is given, the first argument
+ text. If the -regex 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 -useregex "{{msg:(.*?)}}" "{{\\1}}"
+ python replace.py -xml -regex "{{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 == '-useregex':
+ if arg == '-regex':
regex = True
elif arg.startswith('-xmlstart'):
if len(arg) == 9:
More information about the Pywikipedia-l
mailing list