mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
Add reading time for entries
This commit is contained in:
parent
499fb1f7df
commit
ee5a8a05c9
25 changed files with 813 additions and 653 deletions
|
@ -92,6 +92,9 @@ func (f *funcMap) Map() template.FuncMap {
|
|||
"plural": func(key string, n int, args ...interface{}) string {
|
||||
return ""
|
||||
},
|
||||
"timeToRead": func(content string) int {
|
||||
return 0
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,3 +221,9 @@ func formatFileSize(b int64) string {
|
|||
return fmt.Sprintf("%.1f %ciB",
|
||||
float64(b)/float64(div), "KMGTPE"[exp])
|
||||
}
|
||||
|
||||
func timeToRead(content string) int {
|
||||
nbOfWords := len(strings.Fields(content))
|
||||
|
||||
return int(math.Ceil(float64(nbOfWords) / 265))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue