mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-01 06:18:49 +01:00
🎨 块引新建文档存放位置 支持模板变量 https://github.com/siyuan-note/siyuan/issues/4693
This commit is contained in:
parent
ee6c39744f
commit
533590cd05
4 changed files with 35 additions and 4 deletions
|
|
@ -557,7 +557,7 @@ func getDocNameTemplate(c *gin.Context) {
|
|||
nameTemplate = model.Conf.FileTree.CreateDocNameTemplate
|
||||
}
|
||||
|
||||
name, err := model.RenderCreateDocNameTemplate(nameTemplate)
|
||||
name, err := model.RenderGoTemplate(nameTemplate)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
|
|
@ -568,6 +568,36 @@ func getDocNameTemplate(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func getRefCreateSavePath(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
notebook := arg["notebook"].(string)
|
||||
box := model.Conf.Box(notebook)
|
||||
refCreateSavePath := model.Conf.FileTree.RefCreateSavePath
|
||||
if nil != box {
|
||||
refCreateSavePath = box.GetConf().RefCreateSavePath
|
||||
}
|
||||
if "" == refCreateSavePath {
|
||||
refCreateSavePath = model.Conf.FileTree.RefCreateSavePath
|
||||
}
|
||||
|
||||
p, err := model.RenderGoTemplate(refCreateSavePath)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
ret.Data = map[string]interface{}{
|
||||
"path": p,
|
||||
}
|
||||
}
|
||||
|
||||
func changeSort(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue