User:SOTO/bot tricks

= Categories =

Step 1
 python add_text.py -cat:"category" -text:"" -pt:1 -except:"New category"

Step 2
 python replace.py -cat:"New category" -regex "\[\[Category:(New category)\]\]\r\n([\s\S]*)\r\n\[\[Category:(.*?)\]\]" "\2\n\n" -pt:1 Absolute bottom  python replace.py -cat:"New category" -regex "\[\[Category:(New category)\]\]\r\n([\s\S]*)\r\n\[\[Category:(.*?)\]\]" "\2\n\n" "\[\[Category:(New category)\]\]\r\n\[\[Category:(.*?)\]\]" "\n" -pt:1

Adding FTRW category only if contains
 python replace.py -catr:"Example" -regex "\{\{[Ww]ikipediainfo([\s\S]*)\[\[Category:(.*?)\]\]" "{{wikipediainfo\1\n" -excepttext:"Example from the real world" -pt:1

Locations visited by the good Doc
 replace.py "-cat:Example" "-regex" "\[\[Category:Locations visited by the(.*?)Doctor\]\]" "" "-pt:1"

= Templates =

Implementing
 python replace.py -regex "\[\[(:wikipedia|wikipedia):(.*?)\|(.*?)\]\]" "" "\[\[(:wikipedia|wikipedia):(.*?)\|(.*?)\]\]" "" "\{\{(w|wi)\|(.*?)\|\2\}\}" "" "\{\{(w|wi)\|(\w)(.*?)\|(\w)\3\}\}" "" "\{\{(w|wi)\|(\w)(.*?)\|(\w)\3(s)\}\}" "" -summary:"Converting to and " -start:! -pt:1

= General =

Piped italics
 python replace.py -regex "\[\[(.*?) \((.*?)\)\|\1\]\]" "\1" "\[\[(.*?)\|\1\]\]" "\1" -summary:"Cosmetic changes" -pt:1 -start:!

Overly complicated spacing fix
 python replace.py -regex "\{\{Infobox([\s\S]*?)\}\}\r\n\{\{([Yy]ou may)" "{{you may" "\{\{Infobox([\s\S]*?)\}\}\r\n\{\{([Dd]ab page)" "{{dab page" "\{\{Infobox([\s\S]*?)\}\}\r\n\{\{([Ww]ikipediainfo)" "{{Infobox\1}}{{wikipediainfo" "(\}\}\{\{|\{\{)([sS]tub|.*? stub|wikipediainfo)\}\}\{\{(you may|dab page)" "\1\2}}\n{{\3" "\r\n\}\}\{\{(.*?)\}\}\{\{(you may|dab page|wikipediainfo)" "\n}}{{\1}///}{{\2" "\{\{Infobox([\s\S]*?)(\]\]|\)|\w)\}\}\{\{(you may|dab page|wikipediainfo)" "{{Infobox\1\2\n}}{{\3" "\}\/\/\/\}" "}}" "\{\{Infobox([\s\S]*?)\}\}\r\n\r\n" "{{Infobox\1}}\n" -summary:"Spacing" -start:! -pt:1

= Videos =

Step 2
Find-and-replace list into a usable format. python replace.py "" "" -pt:1 -page:"File:Video name 1" -page:"File:Video name 2" You may have to handle videos with double quotation marks in their titles, manually.