Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Ready-made templates for the [phpBB Modders wiki extension](https://github.com/phpbbmodders/phpbb-ext-wiki), adapted from Wikipedia's and other Wikimedia wikis' for what the wiki can do, so a board can start with a useful set instead of writing every template from nothing.

The hatnotes `{{Main}}`, `{{See also}}`, `{{Further}}` and `{{About}}` are in [`templates/`](templates/) so far. The plan for this repository is in the wiki extension's [`docs/TODO/todo-wiki-templates-repo.md`](https://github.com/phpbbmodders/phpbb-ext-wiki/blob/main/docs/TODO/todo-wiki-templates-repo.md).
So far [`templates/`](templates/) holds the hatnotes `{{Main}}`, `{{See also}}`, `{{Further}}` and `{{About}}`; the message boxes `{{Ambox}}`, `{{Update}}`, `{{Unreferenced}}`, `{{More citations needed}}` and `{{Under construction}}`; the stub boxes `{{Asbox}}` and `{{Stub}}`; and `{{Nowrap}}`. The plan for this repository is in the wiki extension's [`docs/TODO/todo-wiki-templates-repo.md`](https://github.com/phpbbmodders/phpbb-ext-wiki/blob/main/docs/TODO/todo-wiki-templates-repo.md).

## Why a separate repository

Expand Down Expand Up @@ -127,6 +127,8 @@ Licence: CC BY-SA 4.0, https://creativecommons.org/licenses/by-sa/4.0/

The header meets what Wikipedia asks of a reuser: it links the page copied and its history (which lists the authors), says the copy was changed, and states the licence. It sits inside `<noinclude>`, so it shows on the template's own page on the board but not in the articles that use it.

Since the header is the documentation on the template's page, a template call written in it is run there. Only `Example:` and `Expect:` lines may hold `{{` or `}}`; write a function's name without braces anywhere else, such as "#if".

The [Check](.github/workflows/check.yml) workflow runs [`tools/check_headers.py`](tools/check_headers.py) on every push and pull request. It fails when a template is missing any of these lines, still says `Changes: TODO`, or still has a `Needs adapting:` line:

```bash
Expand Down
7 changes: 7 additions & 0 deletions data/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
"status": "adapted",
"title": "Template:Unreferenced"
},
"enwiki:1627975": {
"name": "Nowrap",
"reason": "",
"revid": 692794261,
"status": "adapted",
"title": "Template:Nowrap"
},
"enwiki:1721254": {
"name": "See also",
"reason": "",
Expand Down
2 changes: 1 addition & 1 deletion templates/About.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Source: https://en.wikipedia.org/wiki/Template:About
History: https://en.wikipedia.org/w/index.php?title=Template:About&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:About&oldid=1044582448 (09/16/2021 12:56 AM UTC)
Adapted by phpBB Modders.
Changes: rewritten in plain wiki text without Lua (Module:About): one other use and its article, with "other uses" and PAGENAME (disambiguation) when left out; no further use and article pairs, no section or text options; &#32; between the two sentences, since {{#if:}} trims a plain space there; shown in italics instead of the hatnote style, since the wiki allows no <div>; removed the source's documentation and categories.
Changes: rewritten in plain wiki text without Lua (Module:About): one other use and its article, with "other uses" and PAGENAME (disambiguation) when left out; no further use and article pairs, no section or text options; &#32; between the two sentences, since #if trims a plain space there; shown in italics instead of the hatnote style, since the wiki allows no <div>; removed the source's documentation and categories.
Example: {{About|the forum software|the bulletin board in general|Bulletin board}}
Example: {{About|the forum software}}
Example: {{About||the bulletin board in general|Bulletin board}}
Expand Down
2 changes: 1 addition & 1 deletion templates/Ambox.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Source: https://en.wikipedia.org/wiki/Template:Ambox
History: https://en.wikipedia.org/w/index.php?title=Template:Ambox&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:Ambox&oldid=1377691028 (09/30/2026 4:25 PM UTC)
Adapted by phpBB Modders.
Changes: rewritten in plain wiki text without Lua (Module:Message box): a one-cell table with the text, or the issue and the fix, and the date in brackets; no image, type colours, small, talk or category options, since the wiki allows no images in templates, no styles and no <div>; &#32; where {{#if:}} would trim a space; removed the source's documentation and categories.
Changes: rewritten in plain wiki text without Lua (Module:Message box): a one-cell table with the text, or the issue and the fix, and the date in brackets; no image, type colours, small, talk or category options, since the wiki allows no images in templates, no styles and no <div>; &#32; where #if would trim a space; removed the source's documentation and categories.
Example: {{Ambox|issue=This article needs work.|fix=Please help.}}
Example: {{Ambox|text=Plain notice text.}}
Example: {{Ambox|issue=Needs work.|date=October 2026}}
Expand Down
2 changes: 1 addition & 1 deletion templates/Asbox.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Source: https://en.wikipedia.org/wiki/Template:Article_stub_box
History: https://en.wikipedia.org/w/index.php?title=Template:Article_stub_box&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:Article_stub_box&oldid=1271057113 (01/22/2025 12:12 PM UTC)
Adapted by phpBB Modders.
Changes: rewritten in plain wiki text without Lua (Module:Article stub box): a one-cell table; "You can help Wikipedia" names the board instead ({{SITENAME}}); no image, no link to the edit page, no v t e links, no category options; removed the source's documentation and categories.
Changes: rewritten in plain wiki text without Lua (Module:Article stub box): a one-cell table; "You can help Wikipedia" names the board instead (the SITENAME magic word); no image, no link to the edit page, no v t e links, no category options; removed the source's documentation and categories.
Example: {{Asbox|subject=software|name=Template:Software-stub}}
Expect: This software article is a stub. You can help {{SITENAME}} by adding missing information.
Example: {{Asbox|name=Template:X-stub}}
Expand Down
2 changes: 1 addition & 1 deletion templates/Further.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Source: https://en.wikipedia.org/wiki/Template:Further
History: https://en.wikipedia.org/w/index.php?title=Template:Further&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:Further&oldid=1337132284 (02/07/2026 5:55 PM UTC)
Adapted by phpBB Modders.
Changes: rewritten in plain wiki text without Lua (Module:Labelled list hatnote): up to five articles, with their l1 to l5 link texts, listed as A, A and B, or A, B, and C; no topic or selfref options; shown in italics instead of the hatnote style, since the wiki allows no <div>; &#32; before "and", since {{#if:}} trims a plain space there; removed the source's documentation and categories.
Changes: rewritten in plain wiki text without Lua (Module:Labelled list hatnote): up to five articles, with their l1 to l5 link texts, listed as A, A and B, or A, B, and C; no topic or selfref options; shown in italics instead of the hatnote style, since the wiki allows no <div>; &#32; before "and", since #if trims a plain space there; removed the source's documentation and categories.
Example: {{Further|Styles}}
Example: {{Further|Styles|Templates}}
Licence: CC BY-SA 4.0, https://creativecommons.org/licenses/by-sa/4.0/
Expand Down
2 changes: 1 addition & 1 deletion templates/Main.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Source: https://en.wikipedia.org/wiki/Template:Main
History: https://en.wikipedia.org/w/index.php?title=Template:Main&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:Main&oldid=1363280785 (07/09/2026 5:15 AM UTC)
Adapted by phpBB Modders.
Changes: rewritten in plain wiki text without Lua (Module:Labelled list hatnote): up to five articles, with their l1 to l5 link texts, listed as A, A and B, or A, B, and C; no selfref or category options; shown in italics instead of the hatnote style, since the wiki allows no <div>; &#32; before "and", since {{#if:}} trims a plain space there; removed the source's documentation and categories.
Changes: rewritten in plain wiki text without Lua (Module:Labelled list hatnote): up to five articles, with their l1 to l5 link texts, listed as A, A and B, or A, B, and C; no selfref or category options; shown in italics instead of the hatnote style, since the wiki allows no <div>; &#32; before "and", since #if trims a plain space there; removed the source's documentation and categories.
Example: {{Main|History of phpBB}}
Example: {{Main|Installation|Upgrading}}
Example: {{Main|A|B|C}}
Expand Down
10 changes: 10 additions & 0 deletions templates/Nowrap.wiki
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<noinclude>
Source: https://en.wikipedia.org/wiki/Template:Nowrap
History: https://en.wikipedia.org/w/index.php?title=Template:Nowrap&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:Nowrap&oldid=692794261 (11/28/2015 10:13 AM UTC)
Adapted by phpBB Modders.
Changes: rewritten without the <span class="nowrap"> the wiki does not allow: every space in the text becomes a non-breaking space (#replace with an empty search), so the words stay on one line; unlike the original, the text can still break at a hyphen; removed the source's documentation and categories.
Example: {{Nowrap|keep these words together}}
Example: {{Nowrap|10 km}}
Licence: CC BY-SA 4.0, https://creativecommons.org/licenses/by-sa/4.0/
</noinclude>{{#replace:{{{1}}}||&nbsp;}}
2 changes: 1 addition & 1 deletion templates/See also.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Source: https://en.wikipedia.org/wiki/Template:See_also
History: https://en.wikipedia.org/w/index.php?title=Template:See_also&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:See_also&oldid=1292725734 (05/28/2025 1:34 PM UTC)
Adapted by phpBB Modders.
Changes: rewritten in plain wiki text without Lua (Module:Labelled list hatnote): up to five articles, with their l1 to l5 link texts, listed as A, A and B, or A, B, and C; no ifexists, selfref or category options; shown in italics instead of the hatnote style, since the wiki allows no <div>; &#32; before "and", since {{#if:}} trims a plain space there; removed the source's documentation and categories.
Changes: rewritten in plain wiki text without Lua (Module:Labelled list hatnote): up to five articles, with their l1 to l5 link texts, listed as A, A and B, or A, B, and C; no ifexists, selfref or category options; shown in italics instead of the hatnote style, since the wiki allows no <div>; &#32; before "and", since #if trims a plain space there; removed the source's documentation and categories.
Example: {{See also|Configuration}}
Example: {{See also|Configuration|Permissions}}
Example: {{See also|A|B|C}}
Expand Down
2 changes: 1 addition & 1 deletion templates/Under construction.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Source: https://en.wikipedia.org/wiki/Template:Under_construction
History: https://en.wikipedia.org/w/index.php?title=Template:Under_construction&action=history
Revision: https://en.wikipedia.org/w/index.php?title=Template:Under_construction&oldid=1379314703 (10/09/2026 4:59 AM UTC)
Adapted by phpBB Modders.
Changes: rewritten as a call to the Ambox here instead of Mbox; left out the sentence with the time of the last edit (REVISIONTIMESTAMP, which the wiki does not have) and the suggestion to use {{In use}}, which is not in this repository; no user, image or category options; removed the source's documentation and categories.
Changes: rewritten as a call to the Ambox here instead of Mbox; left out the sentence with the time of the last edit (REVISIONTIMESTAMP, which the wiki does not have) and the suggestion to use the In use template, which is not in this repository; no user, image or category options; removed the source's documentation and categories.
Example: {{Under construction}}
Expect: This article or section is undergoing significant expansion or restructuring. You are welcome to assist in its construction by editing it as well. Please remove this notice if this article or section has not been edited in several days.
Licence: CC BY-SA 4.0, https://creativecommons.org/licenses/by-sa/4.0/
Expand Down
15 changes: 13 additions & 2 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_lua_templatestyles_and_unsupported_functions_are_flagged(self):
"{{#if:a|b}}{{#tag:ref|x}}{{formatnum:5}}{{lc:A}}"
"{{PAGENAME}}{{BASEPAGENAME}}{{CURRENTYEAR}}")
self.assertEqual(fetch_template.needs(text), [
"Lua ({{#invoke:}})", "TemplateStyles",
"Lua (#invoke)", "TemplateStyles",
"unsupported #tag, BASEPAGENAME, formatnum"])

def test_translate_markup_is_flagged(self):
Expand Down Expand Up @@ -124,7 +124,7 @@ def write(self, directory, header, body="{{{1}}}"):
return path

def test_fetched_header_is_held_back_until_adapted(self):
header = fetch_template.header(ENWIKI, PAGE, ["Lua ({{#invoke:}})"],
header = fetch_template.header(ENWIKI, PAGE, ["Lua (#invoke)"],
True)
self.assertIn("&oldid=1292725734 (07/09/2026 5:15 AM UTC)", header)
self.assertNotIn("{{Documentation}}", header)
Expand All @@ -134,6 +134,17 @@ def test_fetched_header_is_held_back_until_adapted(self):
"the list of changes still says TODO",
"still needs adapting (see its Needs adapting line)"])

def test_calls_are_only_allowed_in_example_and_expect_lines(self):
header = fetch_template.header(ENWIKI, PAGE, [], True).replace(
"Changes: TODO.", "Changes: uses {{#if:}} now.").replace(
"Licence:", "Example: {{See also|A}}\nExpect: See also: A\n"
"Licence:")
with tempfile.TemporaryDirectory() as directory:
self.assertEqual(check_headers.problems(
self.write(directory, header)),
["a header line other than Example and Expect holds {{ or "
"}}, which the board would run: Changes"])

def test_adapted_header_passes(self):
header = fetch_template.header(ENWIKI, PAGE, [], True).replace(
"Changes: TODO.", "Changes: rewritten without Lua.")
Expand Down
12 changes: 11 additions & 1 deletion tools/check_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
https://creativecommons.org/licenses/by-sa/4.0/;

and no "Needs adapting:" line, which tools/fetch_template.py writes while a
template still uses what the wiki cannot run.
template still uses what the wiki cannot run. Only "Example:" and "Expect:"
lines may hold {{ or }}: the header is the template page's documentation on
a board, so a call anywhere else in it would be run there.

Input: the templates directory (default: templates/ next to this script's
parent). Output: one line per problem on stderr. Exit status: 0 when every
Expand Down Expand Up @@ -102,6 +104,14 @@ def problems(path: Path) -> list:
if not pattern.search(header.group(1))]
if re.search(r"^Changes: TODO\b", header.group(1), re.M):
found.append("the list of changes still says TODO")
# The header is the template page's documentation on a board, so a call
# written in it would be run there; only examples are meant to be
for line in header.group(1).splitlines():
if ("{{" in line or "}}" in line) and not line.startswith(
("Example: ", "Expect: ")):
found.append("a header line other than Example and Expect holds "
"{{ or }}, which the board would run: "
+ line.split(":")[0])
if re.search(r"^Needs adapting:", header.group(1), re.M):
found.append("still needs adapting (see its Needs adapting line)")
return found
Expand Down
2 changes: 1 addition & 1 deletion tools/fetch_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def needs(text: str) -> list:
"""What in a template's text the phpBB Modders wiki cannot run."""
problems = []
if re.search(r"\{\{\s*#invoke\s*:", text, re.IGNORECASE):
problems.append("Lua ({{#invoke:}})")
problems.append("Lua (#invoke)")
if re.search(r"<templatestyles\b", text, re.IGNORECASE):
problems.append("TemplateStyles")
if re.search(r"<(?:translate|languages)\b|<!--T:\d+-->", text,
Expand Down
Loading