🎨 支持合并子文档导出 Word/PDF https://github.com/siyuan-note/siyuan/issues/3219
This commit is contained in:
parent
d0bab3f8ea
commit
c638055057
1 changed files with 10 additions and 8 deletions
|
@ -341,6 +341,16 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string
|
|||
func ExportHTML(id, savePath string, pdf, keepFold, merge bool) (name, dom string) {
|
||||
savePath = strings.TrimSpace(savePath)
|
||||
tree, _ := loadTreeByBlockID(id)
|
||||
|
||||
if merge {
|
||||
var mergeErr error
|
||||
tree, mergeErr = mergeSubDocs(tree)
|
||||
if nil != mergeErr {
|
||||
logging.LogErrorf("merge sub docs failed: %s", mergeErr)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var headings []*ast.Node
|
||||
if pdf { // 导出 PDF 需要标记目录书签
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
|
@ -363,14 +373,6 @@ func ExportHTML(id, savePath string, pdf, keepFold, merge bool) (name, dom strin
|
|||
}
|
||||
}
|
||||
|
||||
if merge {
|
||||
var mergeErr error
|
||||
tree, mergeErr = mergeSubDocs(tree)
|
||||
if nil != mergeErr {
|
||||
logging.LogErrorf("merge sub docs failed: %s", mergeErr)
|
||||
return
|
||||
}
|
||||
}
|
||||
tree = exportTree(tree, true, true, keepFold)
|
||||
name = path.Base(tree.HPath)
|
||||
name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614
|
||||
|
|
Loading…
Add table
Reference in a new issue