UNPKG

wikiparser-node

Version:

A Node.js parser for MediaWiki markup with AST

73 lines (72 loc) 2.56 kB
import Parser from '../index'; import { Token } from './index'; import type { LintError } from '../base'; import type { AstText, CommentToken, IncludeToken, NoincludeToken, TranscludeToken, AstNodes } from '../internal'; import type { SyntaxBase } from '../mixin/syntax'; declare type ExtLinkTypes = 'free-ext-link' | 'ext-link-url' | 'magic-link'; export interface MagicLinkToken extends SyntaxBase { } /** * free external link * * 自由外链 * @classdesc `{childNodes: (AstText|CommentToken|IncludeToken|NoincludeToken)[]}` */ export declare abstract class MagicLinkToken extends Token { #private; readonly childNodes: readonly (AstText | CommentToken | IncludeToken | NoincludeToken | TranscludeToken)[]; abstract get firstChild(): AstText | TranscludeToken; abstract get lastChild(): AstText | CommentToken | IncludeToken | NoincludeToken | TranscludeToken; abstract get children(): (CommentToken | IncludeToken | NoincludeToken | TranscludeToken)[]; abstract get firstElementChild(): CommentToken | IncludeToken | NoincludeToken | TranscludeToken | undefined; abstract get lastElementChild(): CommentToken | IncludeToken | NoincludeToken | TranscludeToken | undefined; get type(): ExtLinkTypes; /** * text of the link * * 链接显示文字 * @since v1.10.0 */ get innerText(): string; /** link / 链接 */ get link(): string; set link(url: string); /** URL protocol / 协议 */ get protocol(): string | undefined; /** @throws `Error` 特殊外链无法更改协议n */ set protocol(value: string); /** * @param url 网址 * @param type 类型 */ constructor(url?: string, type?: ExtLinkTypes, config?: Parser.Config, accum?: Token[]); /** * Get the URL * * 获取网址 * @param articlePath article path / 条目路径 */ getUrl(articlePath?: string): URL | string; cloneNode(): this; /** * @override * @param token node to be inserted / 待插入的节点 * @param i position to be inserted at / 插入位置 */ insertAt(token: string, i?: number): AstText; insertAt<T extends AstNodes>(token: T, i?: number): T; /** * Set the target of the link * * 设置外链目标 * @param url URL containing the protocol / 含协议的网址 */ setTarget(url: string): void; /** * Check if it is a parameter of a template or magic word * * 是否是模板或魔术字参数 */ isParamValue(): boolean; } export {};