feat(report): add dense personal report appendix
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/** Cache compatibility for the Python reader-only vocabulary projection. */
|
||||
const STATUS_LABELS: Readonly<Record<string, string>> = {
|
||||
parameter_sensitive: "参数敏感",
|
||||
pyjhora_behavior_only: "仅单一外部参照,未做多引擎核对",
|
||||
not_multiengine_parity: "仅单一外部参照,未做多引擎核对",
|
||||
unresolved_external_tuple_boundary: "外部边界未对齐",
|
||||
partial_verified: "部分核验",
|
||||
raw_appendix_only: "仅原始附录可见",
|
||||
missing_in_local: "本地暂无",
|
||||
internal_reference_omitted: "内部参照已省略",
|
||||
};
|
||||
const CELL_LABELS: Readonly<Record<string, string>> = {
|
||||
blocked: "暂不可用", executed: "已执行", available: "可用", computed: "已计算",
|
||||
};
|
||||
|
||||
export function cleanReaderAppendixMarkdown(markdown: string): string {
|
||||
return markdown.split(/(^[ \t]*```jyotish-chart[^\n]*\n[\s\S]*?^[ \t]*```[^\n]*(?:\n|$))/m)
|
||||
.map((part, index) => index % 2 ? part : part
|
||||
.replace(new RegExp(`\\b(${Object.keys(STATUS_LABELS).join("|")})\\b`, "g"), (value) => STATUS_LABELS[value])
|
||||
.replace(/\b(?:jyotish_engine\.)?(?:cmd_[a-z0-9_]+|render_pl9_markdown|build_professional_report_reference_packet)\b/g, "本地计算")
|
||||
.replace(/\b(?:[a-z0-9_]+pl9[a-z0-9_]*|pl9_[a-z0-9_]+)(?:\.v\d+)?\b/gi, "外部参照资料")
|
||||
.replace(/\bPL9\b(?:\.pdf)?(?:[ \t]*(?:第[ \t]*\d+(?:[ \t]*[–—/-][ \t]*\d+)*[ \t]*页|(?:pages?|p)[ \t-]*\d+(?:[ \t]*[–—/-][ \t]*\d+)*))?/gi, "外部参照资料")
|
||||
.replace(/\b(?:PyJHora|JHora)\b/gi, "外部参照引擎")
|
||||
.replace(/\|([ \t]*)(`?)(blocked|executed|available|computed)\2([ \t]*)(?=\|)/g,
|
||||
(_match, before: string, quote: string, value: string, after: string) => `|${before}${quote}${CELL_LABELS[value]}${quote}${after}`))
|
||||
.join("");
|
||||
}
|
||||
Reference in New Issue
Block a user