Skip to content

Commit

Permalink
🎨 文档块将 id 从文件名上移到内容中 siyuan-note/siyuan#723
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Dec 13, 2020
1 parent 8089924 commit 134a152
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 35 deletions.
4 changes: 2 additions & 2 deletions javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion javascript/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func main() {
"GetHeadingID": render.HeadingID,
"Caret": util.Caret,
"NewNodeID": ast.NewNodeID,
"FilePath": lute.FilePath,
"NormalizeLinkBase": lute.NormalizeLinkBase,
})
}
31 changes: 0 additions & 31 deletions vditor_ir_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -1291,37 +1291,6 @@ func appendNextToTip(next *ast.Node, tree *parse.Tree) {
}
}

func FilePath(p string) string {
id := FileID(p)
if "" == id {
return p
}
ret := strings.TrimSuffix(p, ".sy.md")
ret = strings.TrimSuffix(ret, "_"+id)
return ret
}

func FileID(p string) (ret string) {
if 0 <= strings.Index(ret, "/") {
p = p[strings.LastIndex(p, "/"):]
}
p = strings.TrimSuffix(p, ".md")
p = strings.TrimSuffix(p, ".sy")
if !strings.Contains(p, "_") {
return
}
idx := strings.LastIndex(p, "_")
if len(p)-1 == idx {
return
}

ret = p[idx+1:]
if len(ret) != len("20201001000000-1949101") {
return ""
}
return
}

func NormalizeLinkBase(linkBase, url string) string {
ret := linkBase
ret = strings.Replace(ret, "://", "", 1)
Expand Down

0 comments on commit 134a152

Please sign in to comment.