Skip to main content

write_document

Function write_document 

Source
pub fn write_document(
    doc: &WikiDocument,
    output_dir: &Path,
    language: &str,
) -> Result<()>
Expand description

写文件到磁盘

将 WikiDocument 渲染后写入 {output_dir}/wiki/{language}/{module_path}.md。 路径统一由 output::wiki_page_path 产出,与 render_all 的保护判定路径 同一规则,保证命名不会漂移。

v22 修复(Unity 实测):Knowledge Card 写盘原先绑定在本函数(页面成功 才写卡片)——模块页面 LLM 生成失败时卡片也丢失,产出「快照/_index 有、磁盘无」的不一致。卡片写盘已移至 render_all 独立循环(页面失败 不影响卡片落盘),本函数只负责页面。