Skip to content

Add categories: [[Category:Name]], category pages and a list of categories - #54

Merged
bonelifer merged 2 commits into
mainfrom
feature/wiki-categories
Oct 13, 2026
Merged

bonelifer merged 2 commits into
mainfrom
feature/wiki-categories

Conversation

@bonelifer

Copy link
Copy Markdown
Contributor

Articles can now be put in categories.

  • Syntax. [[Category:Name]] anywhere in a wiki article. It shows nothing in the text. Names are normalised (first letter capitalised, underscores as spaces), so boxes and Boxes are one category; a sort key after a bar is accepted and ignored. It is read only while a wiki article is saved, like headings and templates, so in a forum post it stays plain text. This means [[Category:Foo]] in a post is no longer a link to an article called "Category:Foo".
  • On the article. A "Categories:" line at the bottom lists the categories the article is in, including any a template adds, each linking to the category's page.
  • Category pages at /wiki/Category:Name. With no article of that name, the page lists the live articles in the category, A to Z, with their descriptions, says it has no description yet and links to write one. If an article Category:Name exists, its text is shown above the list and it keeps its edit and version buttons; ?action=edit and ?action=versions are the ordinary article pages.
  • /wiki/categories lists every category in use with its article count, linked from the overview next to Templates.
  • How membership is found. From the articles' own stored text, as "What links here" does: no new table and no migration beyond one that clears the cached text formatter configuration. Only the live version counts. A template page counts for the categories it names outside <includeonly>.
  • Known limit. A category a template adds shows under the article that uses it, but those articles are not in the category's member list. Listing them needs a membership table, which is written up in docs/TODO.md with the other things not built (sub-categories, [[:Category:Name]], sort keys, and large wikis).
  • New strings are in the English language file only. README and the TODO plan are updated.

Tests

  • Unit tests: 239 tests, 546 assertions, all pass. New categories_test.php and new parsing and rendering cases in markup_test.php.
  • A new browser test passes 16 of 16 on a fresh seeded phpBB 3.3.19 board with SQLite and 15 of 15 on the other four boards (3.3.19 SQLite, 4.0.0-a3-dev SQLite, MySQL 8.0, PostgreSQL 16). It covers hidden marks, normalised names, the category line, a category with no page, a described category and its buttons, the versions page, template categories, the list with counts, the overview link, only the live version counting, and a forum post.
  • The other wiki browser tests (markup, tables, templates, parser functions, template list and page, Start from, limits) and the fixtures check still pass on the seeded SQLite board.

Investigated and written by Claude on behalf of William Jacoby (bonelifer).

bonelifer and others added 2 commits October 12, 2026 22:48
…ories

[[Category:Name]] in a wiki article puts it in a category (names are capitalised, and
underscores count as spaces). The article lists its categories at the bottom,
/wiki/Category:Name lists the live articles in a category with its own description above
when it has one, and /wiki/categories lists every category in use. Members are found from
the articles' own stored text, so a category added by a template shows under the article
but not in the category's list.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The code sniffer wants either a use statement or the full name, not both.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bonelifer

Copy link
Copy Markdown
Contributor Author

Pushed 9d008e8: controller/category.php had a use statement for the categories class and also used its full name in a docblock and the constructor type hint, which the code sniffer reports as "Either use statement or full name must be used" (phpbb.Namespaces.UnusedUse.FullName, three lines). They now use the short name. The sniffer failing stopped the rest of the matrix, so the other jobs were skipped and should run now. The unit tests and the categories browser test still pass locally.


Investigated and written by Claude on behalf of William Jacoby (bonelifer).

@bonelifer
bonelifer merged commit 978b3d5 into main Oct 13, 2026
58 checks passed
@bonelifer
bonelifer deleted the feature/wiki-categories branch October 13, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant