mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-24 07:54:07 +01:00
🐛 导出 PDF/HTML 时丢失自定义表情 Fix https://github.com/siyuan-note/siyuan/issues/5535
This commit is contained in:
parent
b079a35007
commit
236ffd8e64
2 changed files with 47 additions and 10 deletions
|
|
@ -644,6 +644,27 @@ func UnusedAssets() (ret []string) {
|
|||
return
|
||||
}
|
||||
|
||||
func emojisInTree(tree *parse.Tree) (ret []string) {
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
if ast.NodeEmojiImg == n.Type {
|
||||
tokens := n.Tokens
|
||||
idx := bytes.Index(tokens, []byte("src=\""))
|
||||
if -1 == idx {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
src := tokens[idx+len("src=\""):]
|
||||
src = src[:bytes.Index(src, []byte("\""))]
|
||||
ret = append(ret, string(src))
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
ret = gulu.Str.RemoveDuplicatedElem(ret)
|
||||
return
|
||||
}
|
||||
|
||||
func assetsLinkDestsInTree(tree *parse.Tree) (ret []string) {
|
||||
ret = []string{}
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue