NoincludeToken (EN) - bhsd-harry/wikiparser-node GitHub Wiki

Other Languages

Introduction

<noinclude> when not transcluded, and <includeonly> or <onlyinclude> when transcluded. This class inherits all the properties and methods of the NowikiBaseToken class which are not repeated here.

✅ Available in the Mini and Browser versions.

Methods

lint

✅ Expand

returns: LintError[]
Report potential grammar errors.

// lint
var {firstChild} = Parser.parse('<noinclude foo/>');
assert.equal(firstChild, '<noinclude foo/>');
assert.deepStrictEqual(firstChild.lint(), [
	{
		rule: 'no-ignored',
		severity: 'warning',
		message: 'useless attribute',
		startLine: 0,
		startCol: 10,
		startIndex: 10,
		endLine: 0,
		endCol: 14,
		endIndex: 14,
		suggestions: [
			{
				desc: 'remove',
				range: [10, 14],
				text: '',
			},
		],
	},
]);

cloneNode

Expand

returns: this
Deep clone the node.

// cloneNode (main)
var {firstChild} = Parser.parse('</noinclude>');
assert.equal(firstChild, '</noinclude>');
assert.deepStrictEqual(firstChild.cloneNode(), firstChild);
⚠️ **GitHub.com Fallback** ⚠️