🎨 Remove empty code block node from ast https://ld246.com/article/1713689223067

This commit is contained in:
Daniel 2024-04-21 19:37:42 +08:00
parent 4be13b8518
commit 1a62006e1c
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -144,6 +144,21 @@ func genTreeByJSON(node *ast.Node, tree *parse.Tree, idMap *map[string]bool, nee
*needFix = true
return // 忽略空查询嵌入块
}
case ast.NodeCodeBlock:
if 4 > len(node.Children) {
// https://ld246.com/article/1713689223067
existCode := false
for _, child := range node.Children {
if ast.NodeCodeBlockCode.String() == child.TypeStr {
existCode = true
break
}
}
if !existCode {
*needFix = true
return // 忽略空代码块
}
}
}
fixLegacyData(tree.Context.Tip, node, idMap, needFix, needMigrate2Spec1)