Skip to content

Commit

Permalink
fix(TranscludeToken): case-sensitive parser function name
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry committed Nov 17, 2024
1 parent 181f300 commit 5f1c740
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v1.13.4

*2024-11-17*

**Fixed**

- [`TranscludeToken.name`](https://github.com/bhsd-harry/wikiparser-node/wiki/TranscludeToken#name) for some new parser functions, e.g., `{{#dir}}`.

## v1.13.3

*2024-11-14*
Expand Down
2 changes: 1 addition & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@
"#匹配式": "ifeq",
"#若相等": "ifeq",
"#如果相等": "ifeq",
"#若表達式": "ifeq",
"#ifeq": "ifeq",
"#多选式": "switch",
"#多条件式": "switch",
Expand All @@ -397,6 +396,7 @@
"#如有": "ifexist",
"#ifexist": "ifexist",
"#若表达式": "ifexpr",
"#若表達式": "ifexpr",
"#ifexpr": "ifexpr",
"#错误式": "iferror",
"#如果错误": "iferror",
Expand Down
2 changes: 1 addition & 1 deletion config/zhwiki.json
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@
"#匹配式": "ifeq",
"#若相等": "ifeq",
"#如果相等": "ifeq",
"#若表達式": "ifeq",
"#ifeq": "ifeq",
"#多选式": "switch",
"#多条件式": "switch",
Expand All @@ -378,6 +377,7 @@
"#如有": "ifexist",
"#ifexist": "ifexist",
"#若表达式": "ifexpr",
"#若表達式": "ifexpr",
"#ifexpr": "ifexpr",
"#错误式": "iferror",
"#如果错误": "iferror",
Expand Down
2 changes: 1 addition & 1 deletion src/transclude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export abstract class TranscludeToken extends Token {
isSensitive = sensitive.includes(name),
isVar = isSensitive || insensitiveVars.has(canonicalName);
if (isVar || isFunction && canonicalName) {
this.setAttribute('name', canonicalName || lcName);
this.setAttribute('name', canonicalName || lcName.replace(/^#/u, ''));
this.#type = 'magic-word';
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
/^\s*uc\s*$/iu;
Expand Down

0 comments on commit 5f1c740

Please sign in to comment.