@awesome-fe/translate
Version:
Translation utils
24 lines • 879 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.htmlBlockTokenizer = void 0;
function htmlBlockTokenizer(eat, value, silent) {
var _a;
var matches = (_a = /^<(code-examples?|code-tabs)\b(.*?)>([\s\S]*?)<\/\1>/s.exec(value)) !== null && _a !== void 0 ? _a : /^<([\w-]+)[^>]*>.*?\n<\/\1>(\n|$)/s.exec(value);
if (matches) {
try {
if (silent || !matches) {
// either we are not eating (silent) or the match failed
return !!matches;
}
eat(matches[0])({
type: 'htmlRaw',
value: matches[0],
});
}
catch (e) {
this.file.fail('Unmatched plain HTML block tag: ' + e.message);
}
}
}
exports.htmlBlockTokenizer = htmlBlockTokenizer;
//# sourceMappingURL=html-block-tokenizer.js.map