♻️ 移除旧版中的行级元素实现代码 https://github.com/siyuan-note/siyuan/issues/6819

This commit is contained in:
Liang Ding 2022-12-08 18:22:55 +08:00
parent fb1c002500
commit b3599ee150
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 4 additions and 24 deletions

View file

@ -1073,18 +1073,6 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool) (re
} }
switch n.Type { switch n.Type {
case ast.NodeTagOpenMarker: // 配置标签开始标记符
if !wysiwyg {
n.Type = ast.NodeText
n.Tokens = []byte(Conf.Export.TagOpenMarker)
return ast.WalkContinue
}
case ast.NodeTagCloseMarker: // 配置标记结束标记符
if !wysiwyg {
n.Type = ast.NodeText
n.Tokens = []byte(Conf.Export.TagCloseMarker)
return ast.WalkContinue
}
case ast.NodeSuperBlockOpenMarker, ast.NodeSuperBlockLayoutMarker, ast.NodeSuperBlockCloseMarker: case ast.NodeSuperBlockOpenMarker, ast.NodeSuperBlockLayoutMarker, ast.NodeSuperBlockCloseMarker:
if !wysiwyg { if !wysiwyg {
unlinks = append(unlinks, n) unlinks = append(unlinks, n)

View file

@ -700,7 +700,7 @@ func query2Stmt(queryStr string) (ret string) {
if !entering { if !entering {
return ast.WalkContinue return ast.WalkContinue
} }
if ast.NodeTag == n.Type || (n.IsTextMarkType("tag")) { if n.IsTextMarkType("tag") {
tags = append(tags, n.Text()) tags = append(tags, n.Text())
} }
return ast.WalkContinue return ast.WalkContinue

View file

@ -46,8 +46,6 @@ func renderOutline(node *ast.Node, luteEngine *lute.Lute) (ret string) {
return ast.WalkContinue return ast.WalkContinue
} }
switch n.Type { switch n.Type {
case ast.NodeTagOpenMarker, ast.NodeTagCloseMarker:
buf.WriteByte('#')
case ast.NodeBlockRef: case ast.NodeBlockRef:
buf.WriteString(html.EscapeString(treenode.GetDynamicBlockRefText(n))) buf.WriteString(html.EscapeString(treenode.GetDynamicBlockRefText(n)))
return ast.WalkSkipChildren return ast.WalkSkipChildren

View file

@ -656,8 +656,6 @@ func GetContainerText(container *ast.Node) string {
return ast.WalkContinue return ast.WalkContinue
} }
switch n.Type { switch n.Type {
case ast.NodeTagOpenMarker, ast.NodeTagCloseMarker:
buf.WriteByte('#')
case ast.NodeText, ast.NodeLinkText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef, case ast.NodeText, ast.NodeLinkText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent: ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
buf.Write(n.Tokens) buf.Write(n.Tokens)

View file

@ -428,8 +428,6 @@ func resolveRefContent0(node *ast.Node, anchors *map[string]string, depth *int,
case ast.NodeDocument: case ast.NodeDocument:
buf.WriteString(n.IALAttr("title")) buf.WriteString(n.IALAttr("title"))
return ast.WalkStop return ast.WalkStop
case ast.NodeTagOpenMarker, ast.NodeTagCloseMarker:
buf.WriteByte('#')
case ast.NodeText, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef, case ast.NodeText, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent: ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent:
buf.Write(n.Tokens) buf.Write(n.Tokens)
@ -620,11 +618,11 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
} }
assets = append(assets, asset) assets = append(assets, asset)
return return
case ast.NodeTag, ast.NodeInlineMath, ast.NodeCodeSpan, ast.NodeEmphasis, ast.NodeStrong, ast.NodeStrikethrough, ast.NodeMark, ast.NodeSup, ast.NodeSub, ast.NodeKbd, ast.NodeUnderline, ast.NodeTextMark: case ast.NodeInlineMath, ast.NodeCodeSpan, ast.NodeEmphasis, ast.NodeStrong, ast.NodeStrikethrough, ast.NodeMark, ast.NodeSup, ast.NodeSub, ast.NodeKbd, ast.NodeUnderline, ast.NodeTextMark:
typ := treenode.TypeAbbr(n.Type.String()) typ := treenode.TypeAbbr(n.Type.String())
var text string var text string
switch n.Type { switch n.Type {
case ast.NodeTag, ast.NodeEmphasis, ast.NodeStrong, ast.NodeStrikethrough, ast.NodeMark, ast.NodeSup, ast.NodeSub, ast.NodeKbd, ast.NodeUnderline: case ast.NodeEmphasis, ast.NodeStrong, ast.NodeStrikethrough, ast.NodeMark, ast.NodeSup, ast.NodeSub, ast.NodeKbd, ast.NodeUnderline:
text = n.Text() text = n.Text()
case ast.NodeInlineMath: case ast.NodeInlineMath:
text = n.ChildByType(ast.NodeInlineMathContent).TokensStr() text = n.ChildByType(ast.NodeInlineMathContent).TokensStr()
@ -843,7 +841,7 @@ func tagFromNode(node *ast.Node) (ret string) {
return ast.WalkContinue return ast.WalkContinue
} }
if ast.NodeTag == n.Type || n.IsTextMarkType("tag") { if n.IsTextMarkType("tag") {
tagBuilder.WriteString("#") tagBuilder.WriteString("#")
tagBuilder.WriteString(n.Text()) tagBuilder.WriteString(n.Text())
tagBuilder.WriteString("# ") tagBuilder.WriteString("# ")

View file

@ -126,8 +126,6 @@ func NodeStaticContent(node *ast.Node) string {
} }
switch n.Type { switch n.Type {
case ast.NodeTagOpenMarker, ast.NodeTagCloseMarker:
buf.WriteByte('#')
case ast.NodeBlockRef: case ast.NodeBlockRef:
buf.WriteString(GetDynamicBlockRefText(n)) buf.WriteString(GetDynamicBlockRefText(n))
lastSpace = false lastSpace = false