UNPKG

@vrcd-community/zhlint

Version:

A linting tool for Chinese language.

21 lines (20 loc) 653 B
// {% x y %}z{% endx %} // \{\% ([^ ]+?) [^\%]*?\%\} ([^ ]+?) [^\%]*? // (?:\n|\{(?!\%)|[^\{])*? \n \{(?!\%) [^\{] // \{\% end(?:\1) \%\} const matcher = /\{% ([^ ]+?) [^%]*?%\}(?:\n|\{(?!%)|[^{])*?\{% end(?:\1) %\}/g; const parser = (data) => { data.modifiedValue = data.modifiedValue.replace(matcher, (raw, name, index) => { const { length } = raw; data.ignoredByParsers.push({ name, meta: `hexo-${name}`, index, length, originValue: raw }); return '@'.repeat(length); }); return data; }; export default parser;