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

Function FormatReadingTime

utils/util.go:989–1001  ·  view source on GitHub ↗
(seconds int, withoutTag ...bool)

Source from the content-addressed store, hash-verified

987}
988
989func FormatReadingTime(seconds int, withoutTag ...bool) string {
990 strFmt := "<span>%v</span> <small>小时</small> <span>%v</span> <small>分钟</small>"
991 if len(withoutTag) > 0 && withoutTag[0] {
992 strFmt = "%v 小时 %v 分钟"
993 }
994 hour := int(seconds / 3600)
995 second := int(seconds % 3600 / 60)
996 secondStr := strconv.Itoa(second)
997 if second < 10 {
998 secondStr = "0" + secondStr
999 }
1000 return fmt.Sprintf(strFmt, hour, secondStr)
1001}
1002
1003// 拆分markdown
1004func SplitMarkdown(segSharp, markdown string) (markdowns []string) {

Callers 1

PrepareMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected