解析并提取版本控制的commit内容
(str string)
| 74 | |
| 75 | // 解析并提取版本控制的commit内容 |
| 76 | func 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 | // 判断用户是否可以阅读文档. |
| 97 | func isReadable(identify, token string, this *DocumentController) *models.BookResult { |