Skip to content

Fix named entity lookup in POD reader#11018

Merged
jgm merged 1 commit intojgm:mainfrom
silby:push-urtxqpvrpnyv
Aug 4, 2025
Merged

Fix named entity lookup in POD reader#11018
jgm merged 1 commit intojgm:mainfrom
silby:push-urtxqpvrpnyv

Conversation

@silby
Copy link
Contributor

@silby silby commented Aug 4, 2025

Translating entities by name ultimately relies on
Commonmark.Entity.lookupEntity, which de facto requires the entity name to be followed by a semicolon. Paste a semicolon onto the end of the entity name read from POD to look it up.

Fixes #11015

It's noteworthy that lookupEntity, when called with a numeric entity, is indifferent to the presence of a trailing semicolon in the query, whereas for named entities it depends entirely on the weirdness of the table in the HTML spec. This isn't documented by lookupEntity either way.

ghci> lookupEntity (T.pack "#8482")
Just "\8482"
ghci> lookupEntity (T.pack "#8482;")
Just "\8482"
ghci> lookupEntity (T.pack "trade")
Nothing
ghci> lookupEntity (T.pack "#8482;")
Just "\8482"
ghci> lookupEntity (T.pack "aacute")
Just "\225"
ghci> lookupEntity (T.pack "aacute;")
Just "\225"

Translating entities by name ultimately relies on
Commonmark.Entity.lookupEntity, which de facto requires the entity name
to be followed by a semicolon. Paste a semicolon onto the end of the
entity name read from POD to look it up.

Fixes jgm#11015
@jgm jgm merged commit b75c537 into jgm:main Aug 4, 2025
11 of 14 checks passed
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.

POD reader: many E<...> escape sequences are not handled correctly

2 participants