feat: migrate app routes and business modules

This commit is contained in:
2026-08-12 18:22:59 +08:00
parent 555aa00043
commit cc706378c2
247 changed files with 28623 additions and 14988 deletions
+52
View File
@@ -0,0 +1,52 @@
const markdownHeading = /^(#{1,6})\s+(.+)$/;
const orderedListItem = /^(\d+)[.、]\s*(.+)$/;
const unorderedListItem = /^[-*]\s+(.+)$/;
export const formatComplianceContent = (value, documentTitle = "") => {
if (typeof value !== "string" || !value.trim()) return [];
const blocks = value
.replace(/\r\n?/g, "\n")
.split("\n")
.map((line) => line.trim())
.filter(Boolean)
.map((line) => {
const heading = line.match(markdownHeading);
if (heading) {
return {
type: heading[1].length === 1 ? "title" : "heading",
text: heading[2].trim(),
};
}
const ordered = line.match(orderedListItem);
if (ordered) {
return {
type: "list-item",
marker: `${ordered[1]}.`,
text: ordered[2].trim(),
};
}
const unordered = line.match(unorderedListItem);
if (unordered) {
return { type: "list-item", marker: "•", text: unordered[1].trim() };
}
return { type: "paragraph", text: line };
});
const duplicateTitle =
blocks[0]?.type === "title" &&
blocks[0].text === String(documentTitle || "").trim();
if (!duplicateTitle) return blocks;
let contentBlocks = blocks.slice(1);
while (
contentBlocks[0]?.type === "paragraph" &&
/^(?:版本号|版本|发布日期|生效日期)\s*[::]/.test(contentBlocks[0].text)
) {
contentBlocks = contentBlocks.slice(1);
}
return contentBlocks;
};