jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/768737 )

Change subject: Category graph generator: add downsize
......................................................................

Category graph generator: add downsize

uses Graphviz
provides graph in formats dot (gv), svg and html5

Change-Id: Ieac75459ff9f1ac9c34dd4e0cd34986f4cfaf9a0
---
M scripts/category_graph.py
1 file changed, 21 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/category_graph.py b/scripts/category_graph.py
index 4813a3b..33ec5f7 100755
--- a/scripts/category_graph.py
+++ b/scripts/category_graph.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python3

-"""
+r"""
 Visualizes category hierarchy.

 Generates graphical representation in formats dot, svg and html5
@@ -15,11 +15,16 @@
   -to TO         base file name to save, "?" to ask.
   -style STYLE   graphviz style definitions in dot format.
   -depth DEPTH   maximal hierarchy depth. 2 by default.
+  -downsize K    font size divider for subcategories. 4 by default.
+                 Use 1 for the same font size.

 Examples:

 pwb.py -v graph category
-pwb.py -v graph category Life --style rankdir=BT
+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]'
+
 """

 import argparse
@@ -40,6 +45,7 @@
         ap.add_argument('-to', nargs='?', default='')
         ap.add_argument('-style', nargs='?', default='')
         ap.add_argument('-depth', nargs='?', default=2)
+        ap.add_argument('-downsize', nargs='?', default=4)

     def __init__(self, ap, args: argparse.Namespace) -> None:
         """Initializer."""
@@ -85,7 +91,7 @@

         """
         title = cat.title(with_ns=False)
-        size = 4 ** level
+        size = float(args.downsize) ** level
         subcats = sorted(cat.subcategories())

         def node():

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/768737
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ieac75459ff9f1ac9c34dd4e0cd34986f4cfaf9a0
Gerrit-Change-Number: 768737
Gerrit-PatchSet: 5
Gerrit-Owner: Costa Shul <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to