From 65ffb33197c5aff5d9005ff8150fed5c815a0933 Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Wed, 14 Oct 2026 23:08:49 -0500 Subject: [PATCH] Add Start Article, the repository's own article skeleton Template:Start Article is phpBB Modders' own work, not adapted from another wiki: an encyclopedia-style skeleton (Overview, History, See also, References) that the wiki's Start from choice offers for a new article. Its header says "Source: phpBB Modders (own work)"; check_headers.py accepts that in place of the Source and History lines, with no list of changes, and compare_template.py skips it. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- templates/Start Article.wiki | 19 +++++++++++++++++++ tests/test_tools.py | 15 +++++++++++++++ tools/check_headers.py | 21 +++++++++++++++------ tools/compare_template.py | 5 +++++ 5 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 templates/Start Article.wiki diff --git a/README.md b/README.md index 0947790..4f1c87a 100644 --- a/README.md +++ b/README.md @@ -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. -So far [`templates/`](templates/) holds the hatnotes `{{Main}}`, `{{See also}}`, `{{Further}}`, `{{About}}`, `{{Distinguish}}`, `{{For}}`, `{{Other uses}}` and `{{Redirect}}`; the message boxes `{{Ambox}}`, `{{Update}}`, `{{Unreferenced}}`, `{{More citations needed}}`, `{{Primary sources}}`, `{{Cleanup}}`, `{{Confusing}}`, `{{Technical}}`, `{{Expand section}}` and `{{Under construction}}`; the stub boxes `{{Asbox}}` and `{{Stub}}`; the inline helpers `{{Nowrap}}`, `{{Small}}`, `{{Large}}` and `{{Center}}`; `{{Blockquote}}` (phpBB's quote box) and `{{Template link}}`, which shows a template's name in braces as a link; `{{Infobox}}`, a table of labelled facts that other infoboxes can be built on; `{{Cite web}}`, a citation of a web page in Wikipedia's style; and `{{Navbox}}`, a box of links to related articles that the reader opens and closes (wiki extension 1.1.0-a2 and later). The plan this repository was built to, now completed, is archived in the wiki extension's [`docs/TODO/archive/archive1.md`](https://github.com/phpbbmodders/phpbb-ext-wiki/blob/main/docs/TODO/archive/archive1.md#starter-templates-repository-completed-10142026). +So far [`templates/`](templates/) holds the hatnotes `{{Main}}`, `{{See also}}`, `{{Further}}`, `{{About}}`, `{{Distinguish}}`, `{{For}}`, `{{Other uses}}` and `{{Redirect}}`; the message boxes `{{Ambox}}`, `{{Update}}`, `{{Unreferenced}}`, `{{More citations needed}}`, `{{Primary sources}}`, `{{Cleanup}}`, `{{Confusing}}`, `{{Technical}}`, `{{Expand section}}` and `{{Under construction}}`; the stub boxes `{{Asbox}}` and `{{Stub}}`; the inline helpers `{{Nowrap}}`, `{{Small}}`, `{{Large}}` and `{{Center}}`; `{{Blockquote}}` (phpBB's quote box) and `{{Template link}}`, which shows a template's name in braces as a link; `{{Infobox}}`, a table of labelled facts that other infoboxes can be built on; `{{Cite web}}`, a citation of a web page in Wikipedia's style; `{{Navbox}}`, a box of links to related articles that the reader opens and closes (wiki extension 1.1.0-a2 and later); and `Start Article`, the repository's own skeleton for an encyclopedia-style article, which the board's **Start from** choice offers when someone creates a new article. The plan this repository was built to, now completed, is archived in the wiki extension's [`docs/TODO/archive/archive1.md`](https://github.com/phpbbmodders/phpbb-ext-wiki/blob/main/docs/TODO/archive/archive1.md#starter-templates-repository-completed-10142026). ## Why a separate repository diff --git a/templates/Start Article.wiki b/templates/Start Article.wiki new file mode 100644 index 0000000..d00917f --- /dev/null +++ b/templates/Start Article.wiki @@ -0,0 +1,19 @@ + +Source: phpBB Modders (own work) +A starting point for an encyclopedia-style article. When someone creates a new article, the Start from choice above the edit form offers it as "Article" and fills the text box with everything below this box, to replace with the real text. It is not meant to be included in an article. +Licence: CC BY-SA 4.0, https://creativecommons.org/licenses/by-sa/4.0/ +[b]Subject[/b] is (one sentence saying what it is). + +== Overview == +(What it is, what it does, and who it is for.) + +== History == +(How it began and how it has changed.) + +== See also == +[list] +[*][[Related article]] +[/list] + +== References == +(Where the facts above come from, one source per line.) diff --git a/tests/test_tools.py b/tests/test_tools.py index 39675ce..a1a58f7 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -151,6 +151,21 @@ def test_calls_are_only_allowed_in_example_and_expect_lines(self): ["a header line other than Example and Expect holds {{ or " "}}, which the board would run: Changes"]) + def test_own_work_needs_only_its_source_line_and_licence(self): + own = ("\nSource: phpBB Modders (own work)\n" + "Licence: CC BY-SA 4.0, " + check_headers.LICENCE_URL + "\n" + "== Overview ==") + with tempfile.TemporaryDirectory() as directory: + path = self.write(directory, own) + self.assertEqual(check_headers.problems(path), []) + no_licence = own.replace(check_headers.LICENCE_URL, "") + path = self.write(directory, no_licence) + self.assertEqual(check_headers.problems(path), + ["header has no licence notice"]) + other = own.replace("phpBB Modders (own work)", "somebody") + self.assertIn("header has no source URL", + check_headers.problems(self.write(directory, other))) + def test_adapted_header_passes(self): header = fetch_template.header(ENWIKI, PAGE, [], True).replace( "Changes: TODO.", "Changes: rewritten without Lua.") diff --git a/tools/check_headers.py b/tools/check_headers.py index a86aec1..d715646 100755 --- a/tools/check_headers.py +++ b/tools/check_headers.py @@ -17,10 +17,15 @@ * the licence notice, a link to 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. 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. +A template written here rather than adapted, such as a Start template for new +articles, says "Source: phpBB Modders (own work)" instead of the Source and +History lines, and needs no list of changes; it carries the same licence +notice, so the repository stays under one licence. + +There must be no "Needs adapting:" line, which tools/fetch_template.py +writes while a 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 @@ -63,6 +68,8 @@ "licence notice": re.compile(re.escape(LICENCE_URL)), } HEADER = re.compile(r"\A(.*?)", re.S) +# A template written here, not adapted from another wiki +OWN_WORK = re.compile(r"^Source: phpBB Modders \(own work\)$", re.M) def source_problems(text: str) -> list: @@ -99,9 +106,11 @@ def problems(path: Path) -> list: header = HEADER.match(text) if not header: return ["does not start with a header"] - found = source_problems(header.group(1)) + own_work = bool(OWN_WORK.search(header.group(1))) + found = [] if own_work else source_problems(header.group(1)) found += [f"header has no {name}" for name, pattern in REQUIRED.items() - if not pattern.search(header.group(1))] + if not pattern.search(header.group(1)) + and not (own_work and name == "list of changes")] 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 diff --git a/tools/compare_template.py b/tools/compare_template.py index 744c37a..ee63edc 100755 --- a/tools/compare_template.py +++ b/tools/compare_template.py @@ -54,6 +54,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent)) import fetch_template # noqa: E402 +import check_headers # noqa: E402 REPO = Path(__file__).resolve().parent.parent RENDERER = Path(__file__).resolve().parent / "render_on_board.php" @@ -224,6 +225,10 @@ def main() -> int: failed = 0 plan = [] for name in names: + # Written here, so there is no source wiki to compare with + if check_headers.OWN_WORK.search(templates[name]): + print(f"SKIPPED {name}: own work, no source wiki to compare with") + continue examples = EXAMPLE.findall(templates[name]) try: site = site_of(templates[name])