Listify2.py: now using {{stdout}}
← Older revision
Revision as of 16:31, 14 August 2013
(2 intermediate revisions by one user not shown)
Line 282:
Line 282:
Having learned from a [[#ListifySailPlans.py|previous bot run]] what the '''<code>listify</code>''' action of the [[mediawikiwiki:Manual:Pywikipediabot/category.py|category.py]] script does, I want to play with it some more. This time I will create a subpage of [[Xebec]] which lists all the pages that link to the Xebec page, then transclude that list into a '''''See Also''''' section at the bottom of the Xebec page. I am not advocating this as a real-world approach to creating a '''''See Also''''' section, I've never seen them transcluded in like this before, but I'm setting up a future bot run scenario with this, which will tidy up such messes. Here's what I'll be doing...{{Pre|python category.py -pt:5 -log:Listify2.py.log listify -ref:Xebec {{cross}}|scroll=yes|width=auto}} I don't know if '''-ref:''' is an acceptable argument for '''listify''', but either way, the resulting "listified" page will be placed at [[Xebec/See Also]].<br /><br />
Having learned from a [[#ListifySailPlans.py|previous bot run]] what the '''<code>listify</code>''' action of the [[mediawikiwiki:Manual:Pywikipediabot/category.py|category.py]] script does, I want to play with it some more. This time I will create a subpage of [[Xebec]] which lists all the pages that link to the Xebec page, then transclude that list into a '''''See Also''''' section at the bottom of the Xebec page. I am not advocating this as a real-world approach to creating a '''''See Also''''' section, I've never seen them transcluded in like this before, but I'm setting up a future bot run scenario with this, which will tidy up such messes. Here's what I'll be doing...{{Pre|python category.py -pt:5 -log:Listify2.py.log listify -ref:Xebec {{cross}}|scroll=yes|width=auto}} I don't know if '''-ref:''' is an acceptable argument for '''listify''', but either way, the resulting "listified" page will be placed at [[Xebec/See Also]].<br /><br />
−
Okay, yeah, so that was dumb! The first thing <code>category.py</code> asked me was
''"
Please enter the name of the <u>category</u> to listify
"''.
Err, yeah, that wasn't what I wanted at all! So I cancelled the bot run. I'm going to have to rethink this. It looks like I need to temporarily categorize (using {{DL|Category:Listify2.py}}) the pages that link to the Xebec page, then listify them, then remove the temporary category. So, here's how the script will look now...{{Pre|python category.py -pt:5 -log:Listify2a.py.log -ref:Xebec add
+
Okay, yeah, so that was dumb! The first thing <code>category.py</code> asked me was
{{stdout|
Please enter the name of the <u>category</u> to listify
}}
Err, yeah, that wasn't what I wanted at all! So I cancelled the bot run. I'm going to have to rethink this. It looks like I need to temporarily categorize (using {{DL|Category:Listify2.py}}) the pages that link to the Xebec page, then listify them, then remove the temporary category. So, here's how the script will look now...{{Pre|python category.py -pt:5 -log:Listify2a.py.log -ref:Xebec add
python category.py -pt:5 -log:Listify2b.py.log listify
python category.py -pt:5 -log:Listify2b.py.log listify
python replace.py -pt:5 -log:Listify2c.py.log -cat:Listify2.py "<nowiki>[[Category:Listify2.py]]</nowiki>" ""|scroll=yes|width=auto}}
python replace.py -pt:5 -log:Listify2c.py.log -cat:Listify2.py "<nowiki>[[Category:Listify2.py]]</nowiki>" ""|scroll=yes|width=auto}}
Line 301:
Line 301:
Like me, were you traumatised in primary school by a drama teacher telling you to "be a tree"? Let's not go there, shall we?! This script is about learning how to use the '''tree''' action of the [[mediawikiwiki:Manual:Pywikipediabot/category.py|category.py]] script. The purpose of this action is to ''"show a tree of subcategories of a given category"''. That's all I know. Does it rely on the [[mediawikiwiki:Extension:CategoryTree|CategoryTree]] MediaWiki extension? Are the resulting pages AJAX enabled with collapsible sections? Can I specify where in the wiki's category tree structure to start from, or will the script ask me that? Who knows, let's try it and find out.{{Pre|python category.py -pt:5 -log:BeATree.py.log tree|scroll=yes|width=auto|nowiki=yes}}
Like me, were you traumatised in primary school by a drama teacher telling you to "be a tree"? Let's not go there, shall we?! This script is about learning how to use the '''tree''' action of the [[mediawikiwiki:Manual:Pywikipediabot/category.py|category.py]] script. The purpose of this action is to ''"show a tree of subcategories of a given category"''. That's all I know. Does it rely on the [[mediawikiwiki:Extension:CategoryTree|CategoryTree]] MediaWiki extension? Are the resulting pages AJAX enabled with collapsible sections? Can I specify where in the wiki's category tree structure to start from, or will the script ask me that? Who knows, let's try it and find out.{{Pre|python category.py -pt:5 -log:BeATree.py.log tree|scroll=yes|width=auto|nowiki=yes}}
−
As expected, the first thing the script asked was
''"
For which category do you want to create a tree view?
"''
I told it to make a tree for the [[:Category:Sailing Away|Sailing Away]] category. Then the script asked me where to save the file to, or whether I just want it displayed. I chose to save it. This time, unlike my [[#ListifySailPlans.py|very first assumption]] which resulted in the unexpected creation of a new wiki page {{DL|All_pages_in_sail_plans.txt}}, this script went ahead and created the file on my local computer rather than adding a new wiki page. This is what it made...<hr />
+
As expected, the first thing the script asked was
{{stdout|
For which category do you want to create a tree view?
}}
I told it to make a tree for the [[:Category:Sailing Away|Sailing Away]] category. Then the script asked me where to save the file to, or whether I just want it displayed. I chose to save it. This time, unlike my [[#ListifySailPlans.py|very first assumption]] which resulted in the unexpected creation of a new wiki page {{DL|All_pages_in_sail_plans.txt}}, this script went ahead and created the file on my local computer rather than adding a new wiki page. This is what it made...<hr />
[[:Category:Sailing Away|Sailing Away]] (6) (also in [[:Category:Projects|Projects]], [[:Category:User test categories|User test categories]])
[[:Category:Sailing Away|Sailing Away]] (6) (also in [[:Category:Projects|Projects]], [[:Category:User test categories|User test categories]])
#[[:Category:Great places to sail|Great places to sail]] (2) (also in [[:Category:User test categories|User test categories]])
#[[:Category:Great places to sail|Great places to sail]] (2) (also in [[:Category:User test categories|User test categories]])
Line 341:
Line 341:
python replace.py -pt:5 -log:SailPlanStubs5.py.log -cat:SailPlanStubs.py "[[Category:SailPlanStubs.py]]" ""|scroll=yes|width=auto|nowiki=yes}}
python replace.py -pt:5 -log:SailPlanStubs5.py.log -cat:SailPlanStubs.py "[[Category:SailPlanStubs.py]]" ""|scroll=yes|width=auto|nowiki=yes}}
−
That didn't work either, failing again at Part 3 of the script. It failed with the message
<span style="font-family:lucida-console; background:#000; color:#999999;">
0 pages were changed.
</span>
You mean it couldn't find a single page in the whole wiki containing the phrase ''"Ut vehicula elementum magna"''? Damn! Back to the drawing board.
+
That didn't work either, failing again at Part 3 of the script. It failed with the message
{{stdout|
0 pages were changed.
}}
You mean it couldn't find a single page in the whole wiki containing the phrase ''"Ut vehicula elementum magna"''? Damn! Back to the drawing board.
<!--
<!--
{{Pre|
{{Pre|