mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve doc tree parsing
This commit is contained in:
parent
dab89c39fa
commit
ff79d71286
5 changed files with 7 additions and 1 deletions
|
|
@ -36,6 +36,7 @@ func ParseJSONWithoutFix(jsonData []byte, options *parse.Options) (ret *parse.Tr
|
|||
|
||||
ret = &parse.Tree{Name: "", ID: root.ID, Root: &ast.Node{Type: ast.NodeDocument, ID: root.ID, Spec: root.Spec}, Context: &parse.Context{ParseOption: options}}
|
||||
ret.Root.KramdownIAL = parse.Map2IAL(root.Properties)
|
||||
ret.Root.SetIALAttr("type", "doc")
|
||||
ret.Context.Tip = ret.Root
|
||||
if nil == root.Children {
|
||||
return
|
||||
|
|
@ -57,6 +58,7 @@ func ParseJSON(jsonData []byte, options *parse.Options) (ret *parse.Tree, needFi
|
|||
|
||||
ret = &parse.Tree{Name: "", ID: root.ID, Root: &ast.Node{Type: ast.NodeDocument, ID: root.ID, Spec: root.Spec}, Context: &parse.Context{ParseOption: options}}
|
||||
ret.Root.KramdownIAL = parse.Map2IAL(root.Properties)
|
||||
ret.Root.SetIALAttr("type", "doc")
|
||||
for _, kv := range ret.Root.KramdownIAL {
|
||||
if strings.Contains(kv[1], "\n") {
|
||||
val := kv[1]
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ func prepareWriteTree(tree *parse.Tree) (data []byte, filePath string, err error
|
|||
tree.Root.Spec = "1"
|
||||
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, tree.Root.Spec)
|
||||
}
|
||||
tree.Root.SetIALAttr("type", "doc")
|
||||
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
||||
data = renderer.Render()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue