Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-19 19:29:58 +08:00
parent a85655eae0
commit f6dd1a7d7e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
11 changed files with 58 additions and 18 deletions

View file

@ -101,8 +101,9 @@ func Pandoc(from, to, o, content string) (err error) {
}
var (
PandocBinPath string // Pandoc 可执行文件路径
PandocTemplatePath string // Pandoc Docx 模板文件路径
PandocBinPath string // Pandoc 可执行文件路径
PandocTemplatePath string // Pandoc Docx 模板文件路径
PandocColorFilterPath string // Pandoc 颜色过滤器路径
)
func InitPandoc() {
@ -129,11 +130,11 @@ func InitPandoc() {
}
}
PandocTemplatePath = filepath.Join(pandocDir, "pandoc-template.docx")
PandocTemplatePath = filepath.Join(pandocDir, "pandoc-resources", "pandoc-template.docx")
if !gulu.File.IsExist(PandocTemplatePath) {
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc-template.docx")
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc-resources", "pandoc-template.docx")
if "dev" == Mode || !gulu.File.IsExist(PandocTemplatePath) {
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc/pandoc-template.docx")
PandocTemplatePath = filepath.Join(WorkingDir, "pandoc", "pandoc-resources", "pandoc-template.docx")
}
}
if !gulu.File.IsExist(PandocTemplatePath) {
@ -141,6 +142,18 @@ func InitPandoc() {
logging.LogWarnf("pandoc template file [%s] not found", PandocTemplatePath)
}
PandocColorFilterPath = filepath.Join(pandocDir, "pandoc-resources", "pandoc_color_filter.lua")
if !gulu.File.IsExist(PandocColorFilterPath) {
PandocColorFilterPath = filepath.Join(WorkingDir, "pandoc-resources", "pandoc_color_filter.lua")
if "dev" == Mode || !gulu.File.IsExist(PandocColorFilterPath) {
PandocColorFilterPath = filepath.Join(WorkingDir, "pandoc", "pandoc-resources", "pandoc_color_filter.lua")
}
}
if !gulu.File.IsExist(PandocColorFilterPath) {
PandocColorFilterPath = ""
logging.LogWarnf("pandoc color filter file [%s] not found", PandocColorFilterPath)
}
defer eventbus.Publish(EvtConfPandocInitialized)
if gulu.OS.IsWindows() {