This commit is contained in:
Liang Ding 2022-09-15 19:40:50 +08:00
parent b06f074f1b
commit f7520a3f12
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 20 additions and 8 deletions

View file

@ -103,6 +103,10 @@ func WriteTree(tree *parse.Tree) (err error) {
treenode.ReindexBlockTree(tree)
}
if "" == tree.Root.Spec {
treenode.NestedInlines2FlattedSpans(tree)
tree.Root.Spec = "1"
}
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
output := renderer.Render()
@ -181,6 +185,11 @@ func parseJSON2Tree(boxID, p string, jsonData []byte, luteEngine *lute.Lute) (re
ret.Box = boxID
ret.Path = p
if "" == ret.Root.Spec {
treenode.NestedInlines2FlattedSpans(ret)
ret.Root.Spec = "1"
needFix = true
}
if needFix {
renderer := render.NewJSONRenderer(ret, luteEngine.RenderOptions)
output := renderer.Render()