The wiki is where we refer users to for documentation. We need to have a way to keep it up to date and accurate. My intention is to create some scripts that can report back information from the multitude that exists on the wiki, making sure its accuracy and level of completion.
Note: I'm also posting this out as necessity to record the research I've done digging in to this and figure out what method to use to script this functionality. Since pywikibot is set up and available to use, I figure we could use it for this task. Unfortunately, the pywikibot documentation is not very extensive and my coding skills are bare minimum.
Research
The GUICommand template AKA https://www.freecadweb.org/wiki/Template:GuiCommand theoretically should be used on every FreeCAD command page. It looks like this in wikimarkup:
Code: Select all
{{GuiCommand
|Name=SampleCommand
|MenuLocation=Menu → Command
|Workbenches=Wb1, Wb2
|Shortcut=DefaultShortcut
|SeeAlso=OtherTopic
|Version=0.7
}}
I'm trying to write a script that cycles through all the FreeCAD command wiki pages and checks for the completeness and accuracy of this template (for example some wiki pages may be missing template all together, whereas some may just be missing a section from it)
In the HTML source the template creates a table with the classes: fcinfobox and ct
Lets randomly examine the Draft Wire wiki page, if we look at the source we see:
Code: Select all
<table class="fcinfobox wikitable ct" width="100%" style="float: right; width: 230px; margin-left: 1em">
<tr>
<td class="ctTitle" style="font-weight: bold; font-size: 125%;">
<p><a href="/wiki/File:Draft_Wire.svg" class="image"><img alt="Draft Wire.svg" src="/wiki/images/1/10/Draft_Wire.svg" width="32" height="32" /></a><span> </span>Draft Wire
</p>
</td></tr>
<tr>
<th class="ctOdd">Menu location
</th></tr>
<tr>
<td class="ctEven">Draft → Polyline
</td></tr>
<tr>
<th class="ctOdd">Workbenches
</th></tr>
<tr>
<td class="ctEven"><a href="/wiki/Draft_Module" title="Draft Module">Draft</a>, <a href="/wiki/Arch_Module" title="Arch Module">Arch</a>
</td></tr>
<tr>
<th class="ctOdd">Default shortcut
</th></tr>
<tr>
<td class="ctEven">P L
</td></tr>
<tr>
<th class="ctOdd">Introduced in version
</th></tr>
<tr>
<td class="ctEven">0.7
</td></tr>
<tr>
<th class="ctOdd">See also
</th></tr>
<tr>
<td class="ctEven"><a href="/wiki/Draft_Line" title="Draft Line">Draft Line</a>, <a href="/wiki/Draft_BSpline" title="Draft BSpline">Draft BSpline</a>
</td></tr>
- ctTitle for the command name (in this case 'Draft Wire')
- ctOdd for the category names like 'Default shortcut' and 'Introduced in version' etc...
- ctEven for the variables relating to the above categories i.e. '0.7' was the FC version Draft Wire was introduced in etc...