mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-01 06:18:49 +01:00
♻️ Move .sy data parser to https://github.com/siyuan-note/dataparser
This commit is contained in:
parent
3caeeaf29d
commit
bf465e5bbf
9 changed files with 16 additions and 324 deletions
|
|
@ -35,12 +35,12 @@ import (
|
|||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/parse"
|
||||
"github.com/88250/lute/render"
|
||||
"github.com/siyuan-note/dataparser"
|
||||
"github.com/siyuan-note/eventbus"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/cache"
|
||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/search"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/task"
|
||||
|
|
@ -169,7 +169,7 @@ func GetDocHistoryContent(historyPath, keyword string, highlight bool) (id, root
|
|||
isLargeDoc = 1024*1024*1 <= len(data)
|
||||
|
||||
luteEngine := NewLute()
|
||||
historyTree, err := filesys.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
historyTree, err := dataparser.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
if err != nil {
|
||||
logging.LogErrorf("parse tree from file [%s] failed: %s", historyPath, err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import (
|
|||
"github.com/88250/lute/parse"
|
||||
"github.com/88250/lute/render"
|
||||
util2 "github.com/88250/lute/util"
|
||||
"github.com/siyuan-note/dataparser"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/riff"
|
||||
|
|
@ -163,7 +164,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
err = readErr
|
||||
return
|
||||
}
|
||||
tree, _, parseErr := filesys.ParseJSON(data, luteEngine.ParseOptions)
|
||||
tree, _, parseErr := dataparser.ParseJSON(data, luteEngine.ParseOptions)
|
||||
if nil != parseErr {
|
||||
logging.LogErrorf("parse .sy [%s] failed: %s", syPath, parseErr)
|
||||
err = parseErr
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import (
|
|||
"github.com/88250/lute/parse"
|
||||
"github.com/88250/lute/render"
|
||||
"github.com/emirpasic/gods/sets/hashset"
|
||||
"github.com/siyuan-note/dataparser"
|
||||
"github.com/siyuan-note/dejavu"
|
||||
"github.com/siyuan-note/dejavu/cloud"
|
||||
"github.com/siyuan-note/dejavu/entity"
|
||||
|
|
@ -53,7 +54,6 @@ import (
|
|||
"github.com/siyuan-note/httpclient"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/task"
|
||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
|
|
@ -425,7 +425,7 @@ func parseTitleInSnapshot(fileID string, repo *dejavu.Repo, luteEngine *lute.Lut
|
|||
}
|
||||
|
||||
var tree *parse.Tree
|
||||
tree, err = filesys.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
tree, err = dataparser.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
if err != nil {
|
||||
logging.LogErrorf("parse file [%s] failed: %s", fileID, err)
|
||||
return
|
||||
|
|
@ -438,7 +438,7 @@ func parseTitleInSnapshot(fileID string, repo *dejavu.Repo, luteEngine *lute.Lut
|
|||
|
||||
func parseTreeInSnapshot(data []byte, luteEngine *lute.Lute) (isLargeDoc bool, tree *parse.Tree, err error) {
|
||||
isLargeDoc = 1024*1024*1 <= len(data)
|
||||
tree, err = filesys.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
tree, err = dataparser.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/88250/lute"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/parse"
|
||||
"github.com/siyuan-note/dataparser"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/av"
|
||||
|
|
@ -162,7 +163,7 @@ func loadTree(localPath string, luteEngine *lute.Lute) (ret *parse.Tree, err err
|
|||
return
|
||||
}
|
||||
|
||||
ret, err = filesys.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
ret, err = dataparser.ParseJSONWithoutFix(data, luteEngine.ParseOptions)
|
||||
if err != nil {
|
||||
logging.LogErrorf("parse json to tree [%s] failed: %s", localPath, err)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue