renaming MinRead to ReadingTime and adding to documentation.

This commit is contained in:
spf13 2014-01-21 17:12:59 -05:00
parent 50a7f97a62
commit 3851117c25
2 changed files with 707 additions and 707 deletions

View file

@ -63,7 +63,7 @@ type File struct {
type PageMeta struct {
WordCount int
FuzzyWordCount int
MinRead int
ReadingTime int
Weight int
}
@ -311,7 +311,7 @@ func (p *Page) ProcessShortcodes(t bundle.Template) {
func (p *Page) analyzePage() {
p.WordCount = TotalWords(p.Plain())
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
p.MinRead = int((p.WordCount + 212) / 213)
p.ReadingTime = int((p.WordCount + 212) / 213)
}
func (p *Page) permalink() (*url.URL, error) {

View file

@ -308,8 +308,8 @@ func TestWordCount(t *testing.T) {
t.Fatalf("incorrect word count. expected %v, got %v", 500, p.WordCount)
}
if p.MinRead != 3 {
t.Fatalf("incorrect min read. expected %v, got %v", 3, p.MinRead)
if p.ReadingTime != 3 {
t.Fatalf("incorrect min read. expected %v, got %v", 3, p.ReadingTime)
}
checkTruncation(t, p, true, "long page")