Skip to content

Commit

Permalink
fix(TranscludeToken): lint should not report # in HTML entities
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry committed Aug 24, 2024
1 parent 0f4ac9a commit 4356c87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v1.12.7

*2024-08-24*

**Fixed**

- [`TranscludeToken.prototype.lint`](https://github.com/bhsd-harry/wikiparser-node/wiki/TranscludeToken#lint) should not report `#` in an HTML entity as template page fragment

## v1.12.6

*2024-08-17*
Expand Down
5 changes: 4 additions & 1 deletion src/transclude.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
removeComment,
text,
decodeHtml,
print,
escape,

Expand Down Expand Up @@ -342,7 +343,9 @@ export abstract class TranscludeToken extends Token {
errors.push(generateForChild(childNodes[1], rect, 'invalid-invoke', 'illegal module name'));
} else {
const child = childNodes[invoke ? 1 : 0] as AtomToken,
textNode = child.childNodes.find((c): c is AstText => c.type === 'text' && c.data.includes('#'));
textNode = child.childNodes.find(
(c): c is AstText => c.type === 'text' && decodeHtml(c.data).includes('#'),
);
if (textNode) {
const e = generateForChild(child, rect, 'no-ignored', 'useless fragment');
e.fix = {
Expand Down

0 comments on commit 4356c87

Please sign in to comment.