MCPcopy Index your code
hub / github.com/TruthHun/BookStack / parseGitCommit

Function parseGitCommit

controllers/DocumentController.go:76–94  ·  view source on GitHub ↗

解析并提取版本控制的commit内容

(str string)

Source from the content-addressed store, hash-verified

74
75// 解析并提取版本控制的commit内容
76func parseGitCommit(str string) (cont, commit string) {
77 var slice []string
78 arr := strings.Split(str, "<bookstack-git>")
79 if len(arr) > 1 {
80 slice = append(slice, arr[0])
81 str = strings.Join(arr[1:], "")
82 }
83 arr = strings.Split(str, "</bookstack-git>")
84 if len(arr) > 1 {
85 slice = append(slice, arr[1:]...)
86 commit = arr[0]
87 }
88 if len(slice) > 0 {
89 cont = strings.Join(slice, "")
90 } else {
91 cont = str
92 }
93 return
94}
95
96// 判断用户是否可以阅读文档.
97func isReadable(identify, token string, this *DocumentController) *models.BookResult {

Callers 1

ContentMethod · 0.85

Calls 1

appendFunction · 0.50

Tested by

no test coverage detected