mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🎨 新建文档名模板 改为 新建文档存放位置 并支持设置路径 https://github.com/siyuan-note/siyuan/issues/4494
This commit is contained in:
parent
f3aa37f21c
commit
551cbb8c18
14 changed files with 38 additions and 41 deletions
|
|
@ -517,7 +517,7 @@ func lockFile(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func getDocNameTemplate(c *gin.Context) {
|
||||
func getDocCreateSavePath(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
|
|
@ -528,22 +528,22 @@ func getDocNameTemplate(c *gin.Context) {
|
|||
|
||||
notebook := arg["notebook"].(string)
|
||||
box := model.Conf.Box(notebook)
|
||||
nameTemplate := model.Conf.FileTree.CreateDocNameTemplate
|
||||
docCreateSavePathTpl := model.Conf.FileTree.DocCreateSavePath
|
||||
if nil != box {
|
||||
nameTemplate = box.GetConf().CreateDocNameTemplate
|
||||
docCreateSavePathTpl = box.GetConf().DocCreateSavePath
|
||||
}
|
||||
if "" == nameTemplate {
|
||||
nameTemplate = model.Conf.FileTree.CreateDocNameTemplate
|
||||
if "" == docCreateSavePathTpl {
|
||||
docCreateSavePathTpl = model.Conf.FileTree.DocCreateSavePath
|
||||
}
|
||||
|
||||
name, err := model.RenderGoTemplate(nameTemplate)
|
||||
path, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
ret.Data = map[string]interface{}{
|
||||
"name": name,
|
||||
"path": path,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue