This commit is contained in:
Daniel 2024-11-04 11:40:03 +08:00
parent 40cbf3c8c3
commit a547bb7da2
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 16 additions and 20 deletions

View file

@ -169,7 +169,7 @@ func GetNodeSrcTokens(n *ast.Node) (ret string) {
src := n.Tokens[index+len("src=\""):]
if index = bytes.Index(src, []byte("\"")); 0 < index {
src = src[:bytes.Index(src, []byte("\""))]
if !IsRelativePath(src) {
if !util.IsAssetLinkDest(src) {
return
}
@ -182,16 +182,6 @@ func GetNodeSrcTokens(n *ast.Node) (ret string) {
return
}
func IsRelativePath(dest []byte) bool {
if 1 > len(dest) {
return false
}
if '/' == dest[0] {
return false
}
return !bytes.Contains(dest, []byte(":"))
}
func FirstLeafBlock(node *ast.Node) (ret *ast.Node) {
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering || n.IsMarker() {