Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1034863?usp=email )
Change subject: [doc] Fix some sphinx errors ......................................................................
[doc] Fix some sphinx errors
Change-Id: I4f1420c5a08e51288be888ce07e138fe3b90c9bf --- M scripts/add_text.py M scripts/category_graph.py M scripts/harvest_template.py 3 files changed, 45 insertions(+), 40 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/add_text.py b/scripts/add_text.py index c490139..d5c07bd 100755 --- a/scripts/add_text.py +++ b/scripts/add_text.py @@ -38,25 +38,25 @@ Examples --------
-1. Append 'hello world' to the bottom of the sandbox: +Append 'hello world' to the bottom of the sandbox:
python pwb.py add_text -page:Wikipedia:Sandbox \ --summary:"Bot: pywikibot practice" -text:"hello world" + -summary:"Bot: pywikibot practice" -text:"hello world"
-2. Add a template to the top of the pages with 'category:catname': +Add a template to the top of the pages with 'category:catname':
python pwb.py add_text -cat:catname -summary:"Bot: Adding a template" \ --text:"{{Something}}" -except:"{{([Tt]emplate:|)[Ss]omething" -up + -text:"{{Something}}" -except:"{{([Tt]emplate:|)[Ss]omething" -up
-3. Command used on it.wikipedia to put the template in the page without any - category: +Command used on it.wikipedia to put the template in the page without any +category:
python pwb.py add_text -except:"{{([Tt]emplate:|)[Cc]ategorizzare" \ --text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat \ --summary:"Bot: Aggiungo template Categorizzare" + -text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat \ + -summary:"Bot: Aggiungo template Categorizzare" """ # -# (C) Pywikibot team, 2007-2023 +# (C) Pywikibot team, 2007-2024 # # Distributed under the terms of the MIT license. # diff --git a/scripts/category_graph.py b/scripts/category_graph.py index 9be4863..829abb7 100755 --- a/scripts/category_graph.py +++ b/scripts/category_graph.py @@ -26,13 +26,16 @@ Example -------
+Visualizes main category: + pwb.py -v category_graph -from
-Extended example with style settings:: +Extended example with style settings:
pwb.py category_graph -from Life -downsize 1.5 \ --style 'graph[rankdir=BT ranksep=0.5] node[shape=circle style=filled \ -fillcolor=green] edge[style=dashed penwidth=3]' + -style 'graph[rankdir=BT ranksep=0.5] node[shape=circle style=filled \ + fillcolor=green] edge[style=dashed penwidth=3]' +
.. versionadded:: 8.0 """ diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py index 6fc06c9..55f0344 100755 --- a/scripts/harvest_template.py +++ b/scripts/harvest_template.py @@ -1,16 +1,17 @@ #!/usr/bin/env python3 -r""" -Template harvesting script. +r"""Template harvesting script.
Usage (see below for explanations and examples):
python pwb.py harvest_template -transcludes:"..." \ -[default optional arguments] template_parameter PID \ -[local optional arguments] [template_parameter PID [local optional arguments]] + [default optional arguments] template_parameter PID \ + [local optional arguments] \ + [template_parameter PID [local optional arguments]]
python pwb.py harvest_template [generators] -template:"..." \ -[default optional arguments] template_parameter PID \ -[local optional arguments] [template_parameter PID [local optional arguments]] + [default optional arguments] template_parameter PID \ + [local optional arguments] \ + [template_parameter PID [local optional arguments]]
This will work on all pages that transclude the template in the article namespace @@ -52,35 +53,35 @@ "P18" (image):
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ --template:"Infobox person" image P18 + -template:"Infobox person" image P18
-The following command will behave the same as the previous example and also -try to import [[links]] from "birth_place" parameter of the same template -as Wikidata property "P19" (place of birth): +The following command will behave the same as the previous example and +also try to import [[links]] from "birth_place" parameter of the same +template as Wikidata property "P19" (place of birth):
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ --template:"Infobox person" image P18 birth_place P19 + -template:"Infobox person" image P18 birth_place P19
The following command will import both "birth_place" and "death_place" -params with -islink modifier, ie. the bot will try to import values, even -if it doesn't find a [[link]]: +params with -islink modifier, ie. the bot will try to import values, +even if it doesn't find a [[link]]:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ --template:"Infobox person" -islink birth_place P19 death_place P20 + -template:"Infobox person" -islink birth_place P19 death_place P20
The following command will do the same but only "birth_place" can be imported without a link:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ --template:"Infobox person" birth_place P19 -islink death_place P20 + -template:"Infobox person" birth_place P19 -islink death_place P20
-The following command will import an occupation from "occupation" parameter -of "Infobox person" on English Wikipedia as Wikidata property "P106" -(occupation). The page won't be skipped if the item already has that -property but there is not the new value: +The following command will import an occupation from "occupation" +parameter of "Infobox person" on English Wikipedia as Wikidata property +"P106" (occupation). The page won't be skipped if the item already has +that property but there is not the new value:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ --template:"Infobox person" occupation P106 -exists:p + -template:"Infobox person" occupation P106 -exists:p
The following command will import band members from the "current_members" parameter of "Infobox musical artist" on English Wikipedia as Wikidata @@ -88,16 +89,17 @@ if each is linked, and will not add duplicate claims for the same member:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:0 \ --template:"Infobox musical artist" current_members P527 -exists:p -multi + -template:"Infobox musical artist" current_members P527 -exists:p -multi
-The following command will import the category's main topic from the first -anonymous parameter of "Cat main" on English Wikipedia as Wikidata property -"P301" (category's main topic) and whenever a new value is imported, -the inverse claim is imported to the topic item as Wikidata property "P910" -(topic's main category) unless a claim of that property is already there: +The following command will import the category's main topic from the +first anonymous parameter of "Cat main" on English Wikipedia as Wikidata +property "P301" (category's main topic) and whenever a new value is +imported, the inverse claim is imported to the topic item as Wikidata +property "P910" (topic's main category) unless a claim of that property +is already there:
python pwb.py harvest_template -lang:en -family:wikipedia -namespace:14 \ --template:"Cat main" 1 P301 -inverse:P910 -islink + -template:"Cat main" 1 P301 -inverse:P910 -islink
.. note:: This script is a @@ -107,7 +109,7 @@ the -inverse option. """ # -# (C) Pywikibot team, 2013-2023 +# (C) Pywikibot team, 2013-2024 # # Distributed under the terms of MIT license. #