mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-18 06:35:27 +01:00
This commit is contained in:
parent
745582b4e9
commit
68192aaff6
3 changed files with 29 additions and 1 deletions
|
|
@ -34,6 +34,7 @@ import (
|
|||
"github.com/88250/lute/render"
|
||||
sprig "github.com/Masterminds/sprig/v3"
|
||||
"github.com/araddon/dateparse"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/search"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
|
|
@ -57,6 +58,14 @@ func RenderGoTemplate(templateContent string) (ret string, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func RemoveTemplate(p string) (err error) {
|
||||
err = filelock.Remove(p)
|
||||
if nil != err {
|
||||
logging.LogErrorf("remove template failed: %s", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SearchTemplate(keyword string) (ret []*Block) {
|
||||
ret = []*Block{}
|
||||
|
||||
|
|
@ -145,7 +154,7 @@ func DocSaveAsTemplate(id string, overwrite bool) (code int, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
err = os.WriteFile(savePath, md, 0644)
|
||||
err = filelock.WriteFile(savePath, md)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue