\]]*[>\]])\s*/g, "$1");
text = text.replace(/\s*([<\[]\/(?:audio|video)[>\]])/g, "$1");
text = text.replace(/\s*(<(?:source|track)[^>]*>)\s*/g, "$1");
}
if (text.indexOf("]*>)/, "$1");
text = text.replace(/<\/figcaption>\s*/, "");
}
text = text.replace(/\n\n+/g, "\n\n");
const texts = text.split(/\n\s*\n/).filter(Boolean);
text = "";
texts.forEach((textPiece) => {
text += "" + textPiece.replace(/^\n*|\n*$/g, "") + "
\n";
});
text = text.replace(/\s*<\/p>/g, "");
text = text.replace(
/
([^<]+)<\/(div|address|form)>/g,
"
$1
$2>"
);
text = text.replace(
new RegExp("\\s*(?" + allBlocks + "[^>]*>)\\s*
", "g"),
"$1"
);
text = text.replace(/(
/g, "$1");
text = text.replace(/]*)>/gi, "");
text = text.replace(/<\/blockquote><\/p>/g, "
");
text = text.replace(
new RegExp("\\s*(?" + allBlocks + "[^>]*>)", "g"),
"$1"
);
text = text.replace(
new RegExp("(?" + allBlocks + "[^>]*>)\\s*
", "g"),
"$1"
);
if (br) {
text = text.replace(
/<(script|style).*?<\/\\1>/g,
(match) => match[0].replace(/\n/g, "")
);
text = text.replace(/
|
/g, "
");
text = text.replace(
/(
)?\s*\n/g,
(a, b) => b ? a : "
\n"
);
text = text.replace(//g, "\n");
}
text = text.replace(
new RegExp("(?" + allBlocks + "[^>]*>)\\s*
", "g"),
"$1"
);
text = text.replace(
/
(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,
"$1"
);
text = text.replace(/\n<\/p>$/g, "");
preTags.forEach((preTag) => {
const [name, original] = preTag;
text = text.replace(name, original);
});
if (-1 !== text.indexOf("")) {
text = text.replace(/\s?\s?/g, "\n");
}
return text;
}
function removep(html) {
const blocklist = "blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure";
const blocklist1 = blocklist + "|div|p";
const blocklist2 = blocklist + "|pre";
const preserve = [];
let preserveLinebreaks = false;
let preserveBr = false;
if (!html) {
return "";
}
if (html.indexOf("
Se connecter