From 86f203be76b3314703a9441b66a5488cd0371845 Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Fri, 16 Aug 2024 16:42:51 +0800 Subject: [PATCH 1/4] chore: publish v1.12.5 to npm --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a9b7190f..aa3ab31b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wikiparser-node", - "version": "1.12.4", + "version": "1.12.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wikiparser-node", - "version": "1.12.4", + "version": "1.12.5", "license": "GPL-3.0", "dependencies": { "chalk": "^4.1.2" diff --git a/package.json b/package.json index 2bff4aac..9284bd51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wikiparser-node", - "version": "1.12.4", + "version": "1.12.5", "description": "A Node.js parser for MediaWiki markup with AST", "keywords": [ "mediawiki", From e840a91924965e62a582be7097c70bf63cdcf790 Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Sat, 17 Aug 2024 02:03:01 +0800 Subject: [PATCH 2/4] fix(AttributeToken): `lint()` ignores unknown extension tags --- CHANGELOG.md | 8 ++++++++ src/attribute.ts | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dadda3f..38e1f1b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## v1.12.6 + +*2024-08-17* + +**Fixed** + +- [`AttributeToken.prototype.lint`](https://github.com/bhsd-harry/wikiparser-node/wiki/AttributeToken#lint) for unknown extension tags, since [v1.12.5](#v1125) + ## v1.12.5 *2024-08-16* diff --git a/src/attribute.ts b/src/attribute.ts index 50a750fd..766d43b8 100644 --- a/src/attribute.ts +++ b/src/attribute.ts @@ -400,8 +400,8 @@ export abstract class AttributeToken extends Token { } const attrs = extAttrs[tag]; if ( - !(attrs && attrs.has(name)) - && (type === 'ext-attr' || !/\{\{[^{]+\}\}/u.test(name)) + !attrs?.has(name) + && (type === 'ext-attr' ? attrs : !/\{\{[^{]+\}\}/u.test(name)) && ( type === 'ext-attr' && !(tag in htmlAttrs) || !htmlAttrs[tag]?.has(name) From b85ba3d7af3ac66b27af3c8fcb692a16a8651fd0 Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Sat, 17 Aug 2024 13:44:14 +0800 Subject: [PATCH 3/4] feat: export `TokenTypes` and `AST` --- base.ts | 1 + extensions/typings.d.ts | 2 ++ index.ts | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/base.ts b/base.ts index f16b397d..d8a3a877 100644 --- a/base.ts +++ b/base.ts @@ -159,6 +159,7 @@ export interface LintError { export type AST = Record & { range: [number, number]; type?: TokenTypes; + name?: string; childNodes?: AST[]; }; diff --git a/extensions/typings.d.ts b/extensions/typings.d.ts index 55ae3e1e..04d146c5 100644 --- a/extensions/typings.d.ts +++ b/extensions/typings.d.ts @@ -5,6 +5,8 @@ import type {editor} from 'monaco-editor'; import type {CodeJar as CodeJarAsync} from 'codejar-async'; import type {Config, LintError, AST} from '../base'; +export type {AST}; + export interface PrinterBase { include: boolean; } diff --git a/index.ts b/index.ts index 1fa6c734..6a108bbc 100644 --- a/index.ts +++ b/index.ts @@ -12,7 +12,7 @@ import { classes, } from './util/constants'; import {tidy} from './util/string'; -import type {Config, LintError, Parser as ParserBase} from './base'; +import type {Config, LintError, TokenTypes, Parser as ParserBase} from './base'; import type {Title} from './lib/title'; import type {Token} from './internal'; @@ -426,5 +426,5 @@ Object.defineProperties(Parser, def); // @ts-expect-error mixed export styles export = Parser; export default Parser; -export type {Config, LintError}; +export type {Config, LintError, TokenTypes}; export type * from './internal'; From 35faaf9351ad75bf6bdeded8a24ad423a5cb71db Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Sat, 17 Aug 2024 16:26:51 +0800 Subject: [PATCH 4/4] chore: publish v1.12.6 to npm --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index aa3ab31b..c05e8d7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wikiparser-node", - "version": "1.12.5", + "version": "1.12.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wikiparser-node", - "version": "1.12.5", + "version": "1.12.6", "license": "GPL-3.0", "dependencies": { "chalk": "^4.1.2" diff --git a/package.json b/package.json index 9284bd51..27316ae6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wikiparser-node", - "version": "1.12.5", + "version": "1.12.6", "description": "A Node.js parser for MediaWiki markup with AST", "keywords": [ "mediawiki",