Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function loadCheerioRoot(html) {
if (!html) {
return cheerio.root();
}
if (!isHtml(html)) {
// use isDocument=false to create fragment
return cheerio.load(html, null, false).root();
}
return cheerio.load('')(html);
}
_parseElement($, el, filename, content) {
if (el.type === "comment" && cheerioUtils.isHtml(el.data)) {
// Recursive parse call if el.data is recognized as HTML.
return this._extractTranslationDataFromNodes(
Array.from($(el.data)),
$,
filename,
content
);
}
const reference = new exports.TranslationReference(filename, content, el.startIndex);
const node = $(el);
if (this._hasTranslationToken(node)) {
const text = node.html().trim();
if (text.length !== 0) {
return [
_parseElement($, el, filename, content) {
if (el.type === 'comment' && cheerioUtils.isHtml(el.data)) {
// Recursive parse call if el.data is recognized as HTML.
return this._extractTranslationDataFromNodes(Array.from($(el.data)), $, filename, content);
}
const reference = new exports.TranslationReference(filename, content, el.startIndex);
const node = $(el);
if (this._hasTranslationToken(node)) {
const text = this._getNodeHTML(node)
if (text.length !== 0) {
return [new exports.NodeTranslationInfo(node, text, reference, this.options.attributes)];
}
}
// In-depth search for filters