Skip to content

Commit

Permalink
fix(Title): getTitleAttr()
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry committed Aug 4, 2024
1 parent b5baff1 commit 37d4694
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v1.12.3

*2024-08-04*

**Fixed**

- Fix a rare case of [`LinkToken.prototype.toHtml`](https://github.com/bhsd-harry/wikiparser-node/wiki/LinkToken#tohtml) for the [Media namespace](https://www.mediawiki.org/wiki/Help:Namespaces#Media)

## v1.12.2

*2024-07-29*
Expand Down
2 changes: 1 addition & 1 deletion extensions/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface wikiparse {
setI18N: (i18n: Record<string, string>) => void;
setConfig: (config: Config) => void;
getConfig: () => Promise<Config>;
json: (wikitext: string, include: boolean, qid?: number) => Promise<AST>;
json: (wikitext: string, include: boolean, qid?: number, stage?: number) => Promise<AST>;
print: (wikitext: string, include?: boolean, stage?: number, qid?: number) => Promise<[number, string, string][]>;
lint: (wikitext: string, include?: boolean, qid?: number) => Promise<LintError[]>;
highlight?: (ele: HTMLElement, include?: boolean, linenums?: boolean, start?: number) => Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion lib/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export class Title {

/** @private */
getTitleAttr(): string {
return this.title.replace(/Media:/u, '').replace(/["_]/gu, p => p === '"' ? '&quot;' : ' ');
return this.title.replace(/^Media:/u, '').replace(/["_]/gu, p => p === '"' ? '&quot;' : ' ');
}
}

Expand Down

0 comments on commit 37d4694

Please sign in to comment.