Repository navigation
Add more parser functions and magic words - #87
Merged
Merged
Conversation
#titleparts, #rel2abs, #tag, #timel, formatnum, plural and gender, the LOCAL... date words in the board's time zone, and the REVISION... words for the article's current approved version. #timel is #time in the reader's time zone and language; #time stays UTC and English. #tag writes HTML that is then parsed with the article, so only what articles may use takes effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
phpBB 4.0's code sniffer refuses the ?Type shortcut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bonelifer
added a commit
that referenced
this pull request
Oct 15, 2026
A template call written in an article, and a parameter's default value
(`{{{name|...}}}`), may now hold other calls 8 levels deep. It was 3 for
calls and 1 for defaults. **Template nesting depth** under **Extensions
> Wiki > Settings** changes it, from 3 to 20. Deeper calls show as
written.
Saved articles need reparsing to follow a new depth. A new cron task
does that 50 articles at a time on ordinary page views, after this
update and after each change of the setting. The settings page shows a
note while it is running. When it finishes, the category memberships are
worked out again, since a call that is now read (or no longer read) can
add or drop a category.
The reparse can't run in the migration: the wiki's listeners aren't
loaded while the extension is being enabled, so a reparse there would
turn every article's headings and templates into plain text. The
migration only queues it. This update also gets the call forms added in
#87 (`{{formatnum:}}`, `{{#rel2abs:}}` and others) reparsed in existing
articles. The README's older "run the reparser after upgrading" notes
now point to the background reparse.
Testing:
- Unit tests for the limit at 8, the setting at 3 and 9, the depth range
and the reparse queue. The suite passes on phpBB 3.3 and 4.0.
- Claude timed the call pattern on large test articles at depths 3 to
20: under 1 ms in every case.
- On a 3.3 test board, Claude put the board back to its pre-update state
and ran the update. The reparse turned a 6-deep call into a call and
kept every other article's templates and headings. Lowering the setting
to 3 turned the call back into text, and raising it to 8 brought it
back. An article whose deep call adds a category joined that category
after the reparse.
- On a 4.0 test board, Claude ran the update and the reparse; no markup
was lost.
---
Investigated and written by [Claude](https://www.anthropic.com/claude)
on behalf of William Jacoby ([bonelifer](https://github.com/bonelifer)).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the parser functions and magic words that Wikipedia's templates use and the wiki didn't have yet.
{{#titleparts: A/B/C | count | first}}: parts of a name split at/.{{#rel2abs: ../Other | base}}: works out a name from./,../and/. Withoutbase, it uses the article being shown.{{#tag: center | text | attribute=value}}: writes out an HTML tag, which is then parsed with the article. Only HTML that articles may already use takes effect; anything else, such asscript, shows as text.{{formatnum:}}: adds commas as thousands separators, andRremoves them.{{plural:}}uses the English rule.{{gender:}}always gives the neutral form, because phpBB keeps no gender.{{#timel:}}:#timein the reader's time zone, with month and day names in the reader's language.#timeis unchanged (UTC, English).{{LOCALYEAR}},{{LOCALTIME}}and the otherLOCAL...words: theCURRENT...words in the board's time zone.{{REVISIONID}},{{REVISIONUSER}},{{REVISIONTIMESTAMP}}and theREVISION...date words: the article's current approved version. They are empty before the article is first approved.Function names may now contain digits (needed for
#rel2abs), in both the template engine and the article parser. The template service now gets@userfor#timel.#invoke(Lua) is still not planned.Testing:
REVISION...words gave the right number, user and time on a saved template page.Investigated and written by Claude on behalf of William Jacoby (bonelifer).
🤖 Generated with Claude Code