-
Notifications
You must be signed in to change notification settings - Fork 1
ConverterRuleToken (EN)
bhsd edited this page Jun 3, 2024
·
4 revisions
Table of Contents
A single conversion rule.
All of the following properties and methods are not available in the Mini and Browser versions.
Expand
type: string
The language variant.
// variant (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁体}-').querySelector('converter-rule');
assert.strictEqual(rule.variant, 'zh-hans');
rule.variant = 'zh-hant';
assert.equal(rule, '繁體=>zh-hant:繁体');
Expand
type: boolean
Whether it is a unidirectional conversion.
// unidirectional (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁体}-').querySelector('converter-rule');
assert(rule.unidirectional);
rule.unidirectional = false;
assert.equal(rule, 'zh-hans:繁体');
Expand
type: boolean
Whether it is a bidirectional conversion.
// bidirectional (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁体}-').querySelector('converter-rule');
assert(!rule.bidirectional);
rule.bidirectional = true;
assert.equal(rule, 'zh-hans:繁体');
Expand
returns: this
Deep clone the node.
// cloneNode (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁体}-').querySelector('converter-rule');
assert.deepStrictEqual(rule.cloneNode(), rule);
Expand
修改为不转换。
// noConvert (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁體}-').querySelector('converter-rule');
rule.noConvert();
assert.equal(rule, '繁體');
Expand
param: string
target of conversion
Set the target of conversion.
// setTo (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁體}-').querySelector('converter-rule');
rule.setTo('繁体');
assert.equal(rule, '繁體=>zh-hans:繁体');
Expand
param: string
language variant
Set the language variant.
// setVariant (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁體}-').querySelector('converter-rule');
rule.setVariant('zh-cn');
assert.equal(rule, '繁體=>zh-cn:繁體');
Expand
param: string
source of conversion
Set the source of conversion.
// setFrom (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁体}-').querySelector('converter-rule');
rule.setFrom('正體');
assert.equal(rule, '正體=>zh-hans:繁体');
Expand
param: string
Alias for setFrom method.
Expand
Change to bidirectional conversion.
// makeBidirectional (main)
var rule = Parser.parse('-{繁體=>zh-hans:繁体}-').querySelector('converter-rule');
rule.makeBidirectional();
assert.equal(rule, 'zh-hans:繁体');
对维基文本批量执行语法检查的命令行工具
用于维基文本的 ESLint 插件
A command-line tool that performs linting on Wikitext in bulk
ESLint plugin for Wikitext