<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://boincsynergy.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AProjectCounts%2Fdoc</id>
	<title>Module:ProjectCounts/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://boincsynergy.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AProjectCounts%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://boincsynergy.ca/wiki/index.php?title=Module:ProjectCounts/doc&amp;action=history"/>
	<updated>2026-10-05T02:00:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://boincsynergy.ca/wiki/index.php?title=Module:ProjectCounts/doc&amp;diff=1869&amp;oldid=prev</id>
		<title>Al Piskun: Created page with &quot;&#039;&#039;&#039;Module:ProjectCounts&#039;&#039;&#039; computes the figures shown in the statistics block on the Main Page (projects listed, screensavers archived, etc.) directly from the wikitext of the relevant pages, so the numbers stay current as tables and lists are edited. It is also used for section row counts on the BOINC projects page itself.  The module reads the source wikitext of target pages at parse time. Each page it reads is registered as a parser dependency, so any page usi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://boincsynergy.ca/wiki/index.php?title=Module:ProjectCounts/doc&amp;diff=1869&amp;oldid=prev"/>
		<updated>2026-10-01T15:48:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Module:ProjectCounts&amp;#039;&amp;#039;&amp;#039; computes the figures shown in the statistics block on the &lt;a href=&quot;/wiki/Main_Page&quot; title=&quot;Main Page&quot;&gt;Main Page&lt;/a&gt; (projects listed, screensavers archived, etc.) directly from the wikitext of the relevant pages, so the numbers stay current as tables and lists are edited. It is also used for section row counts on the &lt;a href=&quot;/wiki/BOINC_projects&quot; title=&quot;BOINC projects&quot;&gt;BOINC projects&lt;/a&gt; page itself.  The module reads the source wikitext of target pages at parse time. Each page it reads is registered as a parser dependency, so any page usi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Module:ProjectCounts&amp;#039;&amp;#039;&amp;#039; computes the figures shown in the statistics block on the [[Main Page]] (projects listed, screensavers archived, etc.) directly from the wikitext of the relevant pages, so the numbers stay current as tables and lists are edited. It is also used for section row counts on the [[BOINC projects]] page itself.&lt;br /&gt;
&lt;br /&gt;
The module reads the source wikitext of target pages at parse time. Each page it reads is registered as a parser dependency, so any page using these invokes re-renders automatically when the target page changes. No manual purging or updating of figures is needed.&lt;br /&gt;
&lt;br /&gt;
== Live test ==&lt;br /&gt;
&lt;br /&gt;
The following invokes run against live data. Expected values as of October 2026 — 38, 6, 293, 337, 71, 101 — will drift upward as the wiki grows; a sudden &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039; or a red &amp;quot;Script error&amp;quot; means something broke (check section heading names first).&lt;br /&gt;
&lt;br /&gt;
Active: {{#invoke:ProjectCounts|count|Active BOINC Projects}}&lt;br /&gt;
&lt;br /&gt;
Private: {{#invoke:ProjectCounts|count|Private BOINC Projects}}&lt;br /&gt;
&lt;br /&gt;
Completed: {{#invoke:ProjectCounts|count|Completed BOINC Projects}}&lt;br /&gt;
&lt;br /&gt;
Listed: {{#invoke:ProjectCounts|total|Active BOINC Projects|Private BOINC Projects|Completed BOINC Projects}}&lt;br /&gt;
&lt;br /&gt;
Recordings: {{#invoke:ProjectCounts|recordings}}&lt;br /&gt;
&lt;br /&gt;
Documented: {{PAGESINCATEGORY:BOINC projects|pages}}&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
&lt;br /&gt;
=== count ===&lt;br /&gt;
&lt;br /&gt;
Counts the &amp;lt;u&amp;gt;data rows&amp;lt;/u&amp;gt; in the wikitable(s) of one section of a page.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Usage:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|count|Section name|page=Page title}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; (required) — the section heading, exactly as written on the page (without the equals signs; any heading level works).&lt;br /&gt;
* &amp;lt;code&amp;gt;page&amp;lt;/code&amp;gt; (optional) — page to read; defaults to &amp;lt;code&amp;gt;BOINC projects&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Call !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|count|Active BOINC Projects}}&amp;lt;/nowiki&amp;gt; || 38&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|count|Completed BOINC Projects}}&amp;lt;/nowiki&amp;gt; || 293&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|count|Screensaver Gallery|page=BOINC project screensavers}}&amp;lt;/nowiki&amp;gt; || 35 (project rows; see &amp;lt;code&amp;gt;recordings&amp;lt;/code&amp;gt; below)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Return values recorded October 2026; they change as the tables grow.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=== total ===&lt;br /&gt;
&lt;br /&gt;
Sums the data rows of several sections of one page. This produces the &amp;quot;Projects listed&amp;quot; figure on the Main Page.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Usage:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|total|Active BOINC Projects|Private BOINC Projects|Completed BOINC Projects}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns &amp;#039;&amp;#039;&amp;#039;337&amp;#039;&amp;#039;&amp;#039; (38 + 6 + 293 as of October 2026). &amp;lt;code&amp;gt;page&amp;lt;/code&amp;gt; again defaults to &amp;lt;code&amp;gt;BOINC projects&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== recordings ===&lt;br /&gt;
&lt;br /&gt;
Counts &amp;lt;u&amp;gt;unique YouTube recordings&amp;lt;/u&amp;gt; in a section, by deduplicating video IDs found in &amp;lt;code&amp;gt;watch?v=&amp;lt;/code&amp;gt; links, &amp;lt;code&amp;gt;youtu.be/&amp;lt;/code&amp;gt; short links, and &amp;lt;code&amp;gt;img.youtube.com/vi/&amp;lt;/code&amp;gt; thumbnail references. Sections where one table row holds several videos are counted correctly — this measures recordings, not rows.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Usage:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|recordings|Screensaver Gallery|page=BOINC project screensavers}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|recordings}}&amp;lt;/nowiki&amp;gt;  &amp;lt;!-- identical: these are the defaults --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns &amp;#039;&amp;#039;&amp;#039;71&amp;#039;&amp;#039;&amp;#039; as of October 2026.&lt;br /&gt;
&lt;br /&gt;
=== documented ===&lt;br /&gt;
&lt;br /&gt;
Counts &amp;lt;u&amp;gt;distinct existing mainspace articles&amp;lt;/u&amp;gt; linked from a section — link targets must exist (redlinks are skipped) and namespaced links (&amp;lt;code&amp;gt;File:&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Category:&amp;lt;/code&amp;gt;, etc.) are ignored. Defaults to the curated project list on the Main Page.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Usage:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|documented|Local BOINC project wiki pages|page=Main Page}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{#invoke:ProjectCounts|documented}}&amp;lt;/nowiki&amp;gt;  &amp;lt;!-- identical: these are the defaults --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns &amp;#039;&amp;#039;&amp;#039;102&amp;#039;&amp;#039;&amp;#039; as of October 2026 (101 project articles plus the link to the [[BOINC projects]] master table itself).&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039; the Main Page &amp;quot;Projects documented&amp;quot; stat currently uses &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{PAGESINCATEGORY:BOINC projects|pages}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; rather than this function. [[Template:Infobox software|Infobox software]] automatically adds [[:Category:BOINC projects]] to every article containing it, so the category count reflects documented project pages without relying on the curated list. &amp;lt;code&amp;gt;documented&amp;lt;/code&amp;gt; remains available for counting any curated link list per se.&lt;br /&gt;
&lt;br /&gt;
== How the counting works ==&lt;br /&gt;
&lt;br /&gt;
; Section slicing&lt;br /&gt;
: The named heading is located at any heading level; the section runs until the next heading of the same or higher level (or end of page). Sub-sections are therefore included, but siblings are not. The heading name is matched &amp;lt;u&amp;gt;exactly&amp;lt;/u&amp;gt; — a &amp;lt;code&amp;gt;== Screensaver Gallery ==&amp;lt;/code&amp;gt; invoke will no longer match if the heading is later renamed, e.g. to &amp;quot;Gallery&amp;quot;. If a function suddenly returns 0 after an edit, check the heading text first.&lt;br /&gt;
; Row counting (&amp;lt;code&amp;gt;count&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;total&amp;lt;/code&amp;gt;)&lt;br /&gt;
: Data rows = number of &amp;lt;code&amp;gt;|-&amp;lt;/code&amp;gt; row separators at line start, minus one per table for its header separator. Assumes each table has exactly one header row and that every data row begins with &amp;lt;code&amp;gt;|-&amp;lt;/code&amp;gt; on its own line — the format used by all project tables on this wiki.&lt;br /&gt;
&lt;br /&gt;
== Assumptions and limitations ==&lt;br /&gt;
&lt;br /&gt;
* Table-format dependent in the manner described above. Free-form or multi-header tables will mis-count.&lt;br /&gt;
* Correct results depend on section headings staying constant; consider them part of the interface.&lt;br /&gt;
* Lua cannot enumerate category members or template transclusions. For &amp;quot;pages in a category&amp;quot; use &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{PAGESINCATEGORY:Category name|pages}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;; for &amp;quot;pages using a template&amp;quot; see [[Special:WhatLinksHere/Template:Infobox software]].&lt;br /&gt;
&lt;br /&gt;
== Where the module is used ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Statistic !! Location !! Function used&lt;br /&gt;
|-&lt;br /&gt;
| Projects listed || [[Main Page]] || &amp;lt;code&amp;gt;total&amp;lt;/code&amp;gt; over the three sections of [[BOINC projects]]&lt;br /&gt;
|-&lt;br /&gt;
| Screensavers archived || [[Main Page]] || &amp;lt;code&amp;gt;recordings&amp;lt;/code&amp;gt; on [[BOINC project screensavers]]&lt;br /&gt;
|-&lt;br /&gt;
| Section row counts || [[BOINC projects]] section headers || &amp;lt;code&amp;gt;count&amp;lt;/code&amp;gt; per section&lt;br /&gt;
|-&lt;br /&gt;
| Projects documented || [[Main Page]] || (category-based: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{PAGESINCATEGORY:BOINC projects|pages}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, powered by [[Template:Infobox software]])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Maintenance ==&lt;br /&gt;
&lt;br /&gt;
An off-wiki audit script (&amp;lt;code&amp;gt;wiki_reconcile.py&amp;lt;/code&amp;gt;, pure Python, no dependencies) cross-checks the curated Main Page list against pages transcluding the infobox; it reports documented-but-unlisted pages, listed pages lacking an infobox, and redlinks. Run it after large re-organizations of the project listings.&lt;/div&gt;</summary>
		<author><name>Al Piskun</name></author>
	</entry>
</feed>