mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
✨ 行级元素支持多重样式类型 https://github.com/siyuan-note/siyuan/issues/2911
This commit is contained in:
parent
dcee38bcfa
commit
c5f0b96929
13 changed files with 133 additions and 85 deletions
|
|
@ -52,10 +52,14 @@ func resetTree(tree *parse.Tree, titleSuffix string) {
|
|||
// 收集所有引用
|
||||
refIDs := map[string]string{}
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || ast.NodeBlockRefID != n.Type {
|
||||
if !entering || !treenode.IsBlockRef(n) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
refIDs[n.TokensStr()] = "1"
|
||||
defID, _, _ := treenode.GetBlockRef(n)
|
||||
if "" == defID {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
refIDs[defID] = "1"
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
||||
|
|
@ -78,11 +82,15 @@ func resetTree(tree *parse.Tree, titleSuffix string) {
|
|||
|
||||
// 重置内部引用
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || ast.NodeBlockRefID != n.Type {
|
||||
if !entering || !treenode.IsBlockRef(n) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
if "1" != refIDs[n.TokensStr()] {
|
||||
n.Tokens = []byte(refIDs[n.TokensStr()])
|
||||
defID, _, _ := treenode.GetBlockRef(n)
|
||||
if "" == defID {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
if "1" != refIDs[defID] {
|
||||
n.Tokens = []byte(refIDs[defID])
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue