Repository navigation
Show HTML entities in article text as their characters - #67
Merged
Merged
Conversation
As on MediaWiki, ,  , — and other entities written in a wiki article now show as their characters: in the text through s9e's HTMLEntities plugin, and in headings, link texts, link targets, categories and file alt texts through an attribute filter, since the plugin never sees text captured in one piece. A non-breaking space in a link target counts as a space, as in MediaWiki page names. The character is output as text, so <b> shows as "<b>", and an unknown or control-character entity stays as written. Both switch on only while wiki markup is, so forum posts are unchanged, and not while template text is re-parsed (templates::render(), page_view()), which has already been decoded once, so &lt; in a template still shows <. Fixes #66 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.
Fixes #66. As on MediaWiki, an entity written in a wiki article now shows as the character it stands for. Before, that only happened inside a template's output.
HTMLEntitiesplugin is loaded, and its tag is switched on only while wiki markup is (wikilink_listener::toggle_wiki_markup()), like the wiki's other tags.markup::decode_entities(), decodes them at the same moments. In a link target or category name, a non-breaking space counts as a space, as in MediaWiki page names.<b>shows as "" and never becomes markup. An unknown entity, or one for a control character, stays as written.[[links]]in posts included, show entities as written, as before.templates::render()andpage_view()switch decoding off (markup::set_entities()).&lt;in a template still shows "<".Claude tested this through the edit form's preview on a seed-forum wiki test board (phpBB 3.3):
A B,A BandA—Bshow their characters, in text, a heading, a link's text and a link's target;<b>and&lt;show as "" and "<", and&bogus;stays as written;&lt;in a template is not decoded twice.Two new unit tests. The full suite passes on phpBB 3.3 and master with
run-unit-tests.sh. The 30 examples in phpbbmodders/wiki-templates still pass on this branch.Investigated and written by Claude on behalf of William Jacoby (bonelifer).
🤖 Generated with Claude Code