wikiparser-node
Version:
A Node.js parser for MediaWiki markup with AST
60 lines (59 loc) • 1.87 kB
TypeScript
import { Token } from '../index';
import { AtomToken } from '../atom';
import type { Config, LintError, AST } from '../../base';
import type { Title } from '../../lib/title';
/**
* internal link
*
* 内链
* @classdesc `{childNodes: [AtomToken, ...Token[]]}`
*/
export declare abstract class LinkBaseToken extends Token {
#private;
readonly name: string;
abstract get type(): 'link' | 'category' | 'file' | 'gallery-image' | 'imagemap-image' | 'redirect-target';
readonly childNodes: readonly [AtomToken, ...Token[]];
abstract get firstChild(): AtomToken;
abstract get lastChild(): Token;
abstract get children(): [AtomToken, ...Token[]];
abstract get firstElementChild(): AtomToken;
abstract get lastElementChild(): Token;
/** full link / 完整链接 */
get link(): string | Title;
/** 片段标识符 */
get fragment(): string | undefined;
set fragment(fragment: string | undefined);
set link(link: string);
/** interwiki */
get interwiki(): string;
/** @throws `RangeError` 非法的跨维基前缀 */
set interwiki(interwiki: string);
/**
* @param link 链接标题
* @param linkText 链接显示文字
* @param delimiter `|`
*/
constructor(link: string, linkText?: string, config?: Config, accum?: Token[], delimiter?: string);
cloneNode(): this;
/**
* Set the link target
*
* 设置链接目标
* @param link link target / 链接目标
*/
setTarget(link: string): void;
/**
* Set the fragment
*
* 设置片段标识符
* @param fragment URI fragment / 片段标识符
*/
setFragment(fragment?: string): void;
/**
* Set the link text
*
* 设置链接显示文字
* @param linkStr link text / 链接显示文字
*/
setLinkText(linkStr?: string): void;
}