mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 22:08:48 +01:00
🎨 Pandoc template for exporting docx Fix https://github.com/siyuan-note/siyuan/issues/8740
This commit is contained in:
parent
982e109af4
commit
cc8ee6219c
9 changed files with 39 additions and 5 deletions
|
|
@ -412,6 +412,19 @@ func ExportDocx(id, savePath string, removeAssets, merge bool) (err error) {
|
|||
"-o", tmpDocxPath,
|
||||
}
|
||||
|
||||
// Pandoc template for exporting docx https://github.com/siyuan-note/siyuan/issues/8740
|
||||
docxTemplate := gulu.Str.RemoveInvisible(Conf.Export.DocxTemplate)
|
||||
docxTemplate = strings.TrimSpace(docxTemplate)
|
||||
if "" != docxTemplate {
|
||||
if !gulu.File.IsExist(docxTemplate) {
|
||||
logging.LogErrorf("docx template [%s] not found", docxTemplate)
|
||||
msg := fmt.Sprintf(Conf.Language(197), docxTemplate)
|
||||
return errors.New(msg)
|
||||
}
|
||||
|
||||
args = append(args, "--reference-doc", docxTemplate)
|
||||
}
|
||||
|
||||
pandoc := exec.Command(Conf.Export.PandocBin, args...)
|
||||
gulu.CmdAttr(pandoc)
|
||||
pandoc.Stdin = bytes.NewBufferString(content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue