Appropedia:Pywikipediabot/notes
Help here is mostly taken from Pywikipedia-L. It can be copied or transwikied to Meta later.
Restricting namespaces[edit | edit source]
Use the -namespace:n namespace parameter n the command, e.g. -namespace:4 for the "Appropedia:" namespace.
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 want to change all pages in a particular namespace, add the namespace prefix; for example, -start:User:!.) (from mw:Replace.py #Local
- 0 Main
- 1 Talk
- 2 User
- 3 User talk
- 4 Appropedia
- 5 Appropedia talk
- 100 Portal
- 101 Portal talk
- 102 Original
- 103 Original talk
- 104 Layout (legacy of Uniwiki extensions.)
- 105 Layout talk
Or, to find what a namespace's number is, go to Special:Allpages, choose a namespace, click "go", then look for the "namespace=" at the end of the url.
Inserting an exclamation mark & other problematic characters[edit | edit source]
An exclamation mark has a special meaning for some terminals, related to command history. This can be a problem when inserting it using replace.py.
Fix 1[edit | edit source]
This works for any character or string:
For characters you can not properly insert in the command line (might include line breaks in certain situations, "!"and the (C) copyright symbol), create a Template on the wiki which included just that character or string, (and bits for documentation and categorization) and use {{subst:TemplateName}} in your replace text. where TemplateName is something simple. You might use a different one for each string, or a single one, e.g. Template:tempstring which you change each time you have an issue. (e.g. {{subst:\n}} and {{subst:(C)}}). You could try creating a Template:ExMark which has just a ! in it (and bits for documentation and categorization), and then use {{subst:ExMark}}.
Fix 2[edit | edit source]
For just the exclamation mark:
Disable the history search features in bash :
Add :
set +o histexpand
at the bottom of ~/.bashrc,
source ~/.bashrc
and your problem should be fixed.
Fix 3[edit | edit source]
Use HTML entities, e.g. ! for "!".
This has the downside that these codes will appear in the wiki markup.
E.g. python replace.py -cat:"The Transition Handbook" "-- Please do not remove " "!-- Please do not remove "