// 診斷:印出指定句子 charify 後每個 jz-char 的碼位與 class(ASCII 輸出, // 不受 Bash 非 ASCII 正規化影響)。非單元測試,手動執行。 import { setupDom } from "./helpers.mjs"; import { createJuzhen } from "../dist/juzhen.mjs"; function dump(label, lang, text) { const { document } = setupDom('

' + text + "

"); createJuzhen({ spacing: false, longWord: false }).render(document.body); console.log("=== " + label + " (lang=" + lang + ") ==="); document.querySelectorAll("jz-char").forEach((c) => { const cp = "U+" + c.textContent.codePointAt(0).toString(16).toUpperCase().padStart(4, "0"); const cls = Array.from(c.classList).join(" "); console.log(" " + cp + " [" + cls + "]"); }); } dump("简体开明", "zh-Hans", "完了……怎么办?!真是的——他竟然走了。"); dump("繁体全角", "zh-Hant", "完了……怎麼辦?!真是的——他竟然走了。"); // #3:200% 是否被拆斷。印出 jinze 後

的子節點序列。 function dumpKids(label, lang, text) { const { document } = setupDom('

' + text + "

"); createJuzhen({ spacing: true }).render(document.body); console.log("=== kids " + label + " ==="); document.querySelector("p").childNodes.forEach((n) => { if (n.nodeType === 3) { console.log(" text: " + JSON.stringify(n.data)); } else { console.log(" <" + n.nodeName.toLowerCase() + "> " + JSON.stringify(n.textContent)); } }); } dumpKids("百分号", "zh-Hans", "效率提升了 200%,达到约 3.5 倍。");