User:SOTO/bot tricks: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
no edit summary
Tag: sourceedit
No edit summary
Tag: sourceedit
Line 11: Line 11:




=== Adding FTRW category only if contains {{tl|wikipediainfo}} ===
=== Adding FTRW category only if contains <nowiki>{{</nowiki><code>wikipediainfo</code>}} ===
<pre style="background:black;color:white">
<pre style="background:black;color:white">
python replace.py -catr:"Example" -regex "\{\{[Ww]ikipediainfo([\s\S]*)\[\[Category:(.*?)\]\]" "{{wikipediainfo\1[[Category:\2]]\n[[Category:Example from the real world]]" -excepttext:"Example from the real world" -pt:1
python replace.py -catr:"Example" -regex "\{\{[Ww]ikipediainfo([\s\S]*)\[\[Category:(.*?)\]\]" "{{wikipediainfo\1[[Category:\2]]\n[[Category:Example from the real world]]" -excepttext:"Example from the real world" -pt:1
Line 22: Line 22:
</pre>
</pre>


= Templates =
=== Implementing <nowiki>{{</nowiki><code>w/wi</code>}} ===
<pre style="background:black;color:white">
python replace.py -regex "''\[\[(:wikipedia|wikipedia):(.*?)\|(.*?)\]\]''" "{{wi|\2|\3}}" "\[\[(:wikipedia|wikipedia):(.*?)\|(.*?)\]\]" "{{w|\2|\3}}" "\{\{(w|wi)\|(.*?)\|\2\}\}" "{{\1|\2}}" "\{\{(w|wi)\|(\w)(.*?)\|(\w)\3\}\}" "{{\1|\4\3}}" "\{\{(w|wi)\|(\w)(.*?)\|(\w)\3(s)\}\}" "{{\1|\4\3|\4\3s}}" -summary:"Converting to {{w}} and {{wi}}" -start:! -pt:1
</pre>


= General =
= General =
Cookies help us deliver our services. By using our services, you agree to our use of cookies.