An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve pandoc export
Danielb59c6fda43c8
diff --git a/kernel/model/export.go b/kernel/model/export.goindex 70dbe32fbc..db514d0958 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -812,8 +812,9 @@ func ExportDocx(id, savePath string, removeAssets, merge bool) (fullPath string,pandoc.Stdin = bytes.NewBufferString(content)output, err := pandoc.CombinedOutput()if err != nil {+ argStr := strings.Join(args, " ")msg := gulu.DecodeCmdOutput(output)- logging.LogErrorf("export docx failed: %s", msg)+ logging.LogErrorf("export docx [%s] failed: %s", argStr, msg)err = errors.New(fmt.Sprintf(Conf.Language(14), msg))return}diff --git a/kernel/util/pandoc.go b/kernel/util/pandoc.goindex 1cf80595b8..67470c3675 100644--- a/kernel/util/pandoc.go+++ b/kernel/util/pandoc.go@@ -111,25 +111,6 @@ func InitPandoc() {return}- tempPandocDir := filepath.Join(TempDir, "pandoc")-- if confPath := filepath.Join(ConfDir, "conf.json"); gulu.File.IsExist(confPath) {- // Workspace built-in Pandoc is no longer initialized after customizing Pandoc path https://github.com/siyuan-note/siyuan/issues/8377- if data, err := os.ReadFile(confPath); err == nil {- conf := map[string]interface{}{}- if err = gulu.JSON.UnmarshalJSON(data, &conf); err == nil && nil != conf["export"] {- export := conf["export"].(map[string]interface{})- if customPandocBinPath := export["pandocBin"].(string); !strings.HasPrefix(customPandocBinPath, tempPandocDir) {- if pandocVer := getPandocVer(customPandocBinPath); "" != pandocVer {- PandocBinPath = customPandocBinPath- logging.LogInfof("custom pandoc [ver=%s, bin=%s]", pandocVer, PandocBinPath)- return- }- }- }- }- }-PandocTemplatePath = filepath.Join(WorkingDir, "pandoc-resources", "pandoc-template.docx")if !gulu.File.IsExist(PandocTemplatePath) {PandocTemplatePath = filepath.Join(WorkingDir, "pandoc", "pandoc-resources", "pandoc-template.docx")@@ -150,6 +131,25 @@ func InitPandoc() {defer eventbus.Publish(EvtConfPandocInitialized)+ tempPandocDir := filepath.Join(TempDir, "pandoc")++ if confPath := filepath.Join(ConfDir, "conf.json"); gulu.File.IsExist(confPath) {+ // Workspace built-in Pandoc is no longer initialized after customizing Pandoc path https://github.com/siyuan-note/siyuan/issues/8377+ if data, err := os.ReadFile(confPath); err == nil {+ conf := map[string]interface{}{}+ if err = gulu.JSON.UnmarshalJSON(data, &conf); err == nil && nil != conf["export"] {+ export := conf["export"].(map[string]interface{})+ if customPandocBinPath := export["pandocBin"].(string); !strings.HasPrefix(customPandocBinPath, tempPandocDir) {+ if pandocVer := getPandocVer(customPandocBinPath); "" != pandocVer {+ PandocBinPath = customPandocBinPath+ logging.LogInfof("custom pandoc [ver=%s, bin=%s]", pandocVer, PandocBinPath)+ return+ }+ }+ }+ }+ }+if gulu.OS.IsWindows() {if "amd64" == runtime.GOARCH {PandocBinPath = filepath.Join(tempPandocDir, "bin", "pandoc.exe")