Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21f31daac5d1de6

Jump to content

Module:SST/doc

From Wikipedia, the free encyclopedia

This module is the core router for the Specific-Source Template System (SSTS). It acts as a dynamic wrapper and dispatcher for specific-source templates. It intercepts specific parameters, routes the request to the correct host engine (such as Internet Archive, HathiTrust, or Google Books), and passes the formatted data to standard citation templates like {{cite book}}.

Usage

[edit]

Creating a new specific-source template requires two steps: creating the front-end template, and adding the book's data to the correct alphabetized "shard."

Step 1: the front-end template

[edit]

The front-end template (e.g., {{The Ottoman Empire}}) is a lightweight wrapper that routes the user's input to Module:SST.

Single-book (example template)
<includeonly>{{#invoke:SST|single|id=HISTORY_OF_YOLO_COUNTY}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
  • id: The unique base identifier for the book located in the data shard.

If the book has multiple volumes or editions, replace single with set. You can combine it with a {{#switch}} statement and {{Normalize volume and edition}} to route to the correct data block within the book's standalone shard.

Three editions (example template)
<includeonly>{{#invoke:SST|set
| id = IMBER_THE_OTTOMAN_EMPIRE
| key = {{#switch:{{#invoke:Normalize volume and edition|edition|{{{edition|}}}}}
  | 3 | 2019 = 2019
  | 2 | 2009 = 2009
  | 1 | 2002 | #default = 2002
}}
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
7 volume set (example template)
<includeonly>{{#invoke:SST|set
| id = BYZANTINE_SEALS
| key = {{#switch:{{#invoke:Normalize volume and edition|volume|{{{volume|}}}}}
  | 1 | I = 1
  | 2 | II = 2
  | 3 | III = 3
  | 4 | IV = 4
  | 5 | V = 5
  | 6 | VI = 6
  | 7 | VII = 7
  | all | ALL | #default = ALL
}}
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
  • id: The base identifier for the entire set (maps to the shard filename).
  • key: The specific variant key (e.g., 1, 2, ALL) to append to the base ID.


Architecture & Data Sharding

[edit]

To avoid loading a single massive data table into memory, configuration data is split into alphabetical subpages (shards).

  1. Validation: When invoked, the module verifies that a valid host code (e.g., IA, Hathi, GBook) and Book Key are provided.
  2. Data Retrieval: It extracts the first letter of the Book Key (e.g., "B" from "BYZANTINE_SEALS_V1") and uses mw.loadData() to retrieve the corresponding subpage (e.g., Module:SST/shards/B).
  3. Engine Execution: It then loads the Module:SST/hosts engine, passing the shard data and the user's template arguments to build the final URLs.
  4. Output: The compiled arguments are expanded into the base template defined in the shard (defaulting to {{cite book}}).

Error Tracking

[edit]

The module utilizes an error tracking system.

  • Fatal Execution Errors: If the module encounters a system failure (e.g., an unsupported host engine) or a native CS1 red error, it outputs a bold red error message in the citation and categorizes the page into Category:SSTS errors.
  • Missing Records: If a citation requests a book key, shard, or volume that does not exist in the database, it outputs a visible error and categorizes the page into Category:SSTS missing records.
  • Parameter Logic Faults: If an editor uses an invalid combination of parameters that conflicts with the shard's architecture (e.g., adding |title= or |article= to a {{cite encyclopedia}}), the module will attempt to silently resolve the citation to prevent a red error, but will flag the page in the hidden category Category:SSTS parameter logic faults.

Testcases

[edit]

Testcases: Template:Catalogue of Byzantine Seals at Dumbarton Oaks and in the Fogg Museum of Art/testcases