-
Notifications
You must be signed in to change notification settings - Fork 2
IncludeToken
bhsd edited this page Nov 25, 2023
·
27 revisions
非嵌入时为被<includeonly>
和</includeonly>
包裹的内容,嵌入时为被<noinclude>
和</noinclude>
包裹的内容。
✅ 展开
type: string
标签名。
var {firstChild} = Parser.parse('<includeonly>a</includeonly>');
assert.equal(firstChild, '<includeonly>a</includeonly>');
assert.strictEqual(firstChild.name, 'includeonly');
✅ 展开
type: boolean
是否闭合。
var {firstChild} = Parser.parse('<includeonly>a');
assert.equal(firstChild, '<includeonly>a');
assert.strictEqual(firstChild.closed, false);
展开
type: true
不可增删子节点,只读。
var {firstChild} = Parser.parse('<includeonly>a</includeonly>');
assert.equal(firstChild, '<includeonly>a</includeonly>');
assert(firstChild.fixed);
展开
type: true
IncludeToken 不可见,只读。
var {firstChild} = Parser.parse('<includeonly>a</includeonly>');
assert.equal(firstChild, '<includeonly>a</includeonly>');
assert(firstChild.hidden);
展开
type: boolean
是否自封闭。
var {firstChild} = Parser.parse('<includeonly>a</includeonly>');
assert.equal(firstChild, '<includeonly>a</includeonly>');
assert.strictEqual(firstChild.selfClosing, false);
展开
type: string
内部 wikitext,只读。
var {firstChild} = Parser.parse('<includeonly>a</includeonly>');
assert.equal(firstChild, '<includeonly>a</includeonly>');
assert.strictEqual(firstChild.innerText, 'a');
展开
returns: this
深拷贝节点。
var {
childNodes: [closed, selfClosing, open]
} = Parser.parse('<includeonly>a</includeonly><includeonly/><includeonly>b');
assert.equal(closed, '<includeonly>a</includeonly>');
assert.equal(selfClosing, '<includeonly/>');
assert.equal(open, '<includeonly>b');
assert.deepStrictEqual(closed.cloneNode(), closed);
assert.deepStrictEqual(selfClosing.cloneNode(), selfClosing);
assert.deepStrictEqual(open.cloneNode(), open);
展开
清除标签属性。<includeonly>
标签的属性没有任何效果。
var {firstChild} = Parser.parse('<includeonly name="a">a</includeonly>');
assert.equal(firstChild, '<includeonly name="a">a</includeonly>');
firstChild.removeAttr();
assert.equal(firstChild, '<includeonly>a</includeonly>');
对维基文本批量执行语法检查的命令行工具
用于维基文本的 VSCode 扩展
A command-line tool that performs linting on Wikitext in bulk
VSCode extension for Wikitext