Update src/data/generate-data.js to translate code tags

This commit is contained in:
Sizhe Zhao 2021-07-09 23:45:00 +08:00
parent 3feba5ec0b
commit c3c4eb9c9d

View File

@ -25,7 +25,11 @@ const builtins = $$("a#toc-Builtin-Functions+ul > li").map(element => {
doc += "\n```";
} else {
curr_paragraph.childNodes.forEach(elem => {
doc += elem.textContent.replace(/(\s\s+)/gm, " ");
if (elem.nodeName == "CODE") {
console.log(elem.innerHTML);
doc += "`" + elem.innerHTML.replaceAll(/<span .+?>(.+?)<\/span>/gm, "$1") + "`";
} else
doc += elem.textContent.replace(/(\s\s+)/gm, " ");
});
}