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