mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-19 14:56:09 +01:00
🎨 Built-in Pandoc export .docx template https://github.com/siyuan-note/siyuan/issues/16861
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
1f02650b38
commit
1012d8b486
11 changed files with 44 additions and 4 deletions
|
|
@ -101,7 +101,8 @@ func Pandoc(from, to, o, content string) (err error) {
|
|||
}
|
||||
|
||||
var (
|
||||
PandocBinPath string // Pandoc 可执行文件路径
|
||||
PandocBinPath string // Pandoc 可执行文件路径
|
||||
PandocTemplatePath string // Pandoc Docx 模板文件路径
|
||||
)
|
||||
|
||||
func InitPandoc() {
|
||||
|
|
@ -128,6 +129,18 @@ func InitPandoc() {
|
|||
}
|
||||
}
|
||||
|
||||
PandocTemplatePath = filepath.Join(pandocDir, "pandoc-template.docx")
|
||||
if !gulu.File.IsExist(PandocTemplatePath) {
|
||||
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc-template.docx")
|
||||
if "dev" == Mode || !gulu.File.IsExist(PandocTemplatePath) {
|
||||
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc/pandoc-template.docx")
|
||||
}
|
||||
}
|
||||
if !gulu.File.IsExist(PandocTemplatePath) {
|
||||
PandocTemplatePath = ""
|
||||
logging.LogWarnf("pandoc template file [%s] not found", PandocTemplatePath)
|
||||
}
|
||||
|
||||
defer eventbus.Publish(EvtConfPandocInitialized)
|
||||
|
||||
if gulu.OS.IsWindows() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue