hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 673e41bf6a5a7c84ef780b274a822ff56b26607c
parent 32c0e3fd1ff6f19d77efd5fb27c1913248e49fbe
Author: Hanchen Wang <hanchen.wang@mail.utoronto.ca>
Date:   Thu, 19 May 2016 15:17:36 -0400

hugolib: Add expiredStats to build feedback

Diffstat:
Mhugolib/site.go | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/hugolib/site.go b/hugolib/site.go
@@ -1877,6 +1877,7 @@ func (s *Site) renderRobotsTXT() error {
 func (s *Site) Stats() {
 	jww.FEEDBACK.Println(s.draftStats())
 	jww.FEEDBACK.Println(s.futureStats())
+	jww.FEEDBACK.Println(s.expiredStats())
 	jww.FEEDBACK.Printf("%d pages created\n", len(s.Pages))
 	jww.FEEDBACK.Printf("%d non-page files copied\n", len(s.Files))
 	jww.FEEDBACK.Printf("%d paginator pages created\n", s.Info.paginationPageCount)
@@ -2172,6 +2173,25 @@ func (s *Site) futureStats() string {
 	return "0 of " + msg
 }
 
+func (s *Site) expiredStats() string {
+	var msg string
+
+	switch s.expiredCount {
+	case 0:
+		return "0 expired content"
+	case 1:
+		msg = "1 expired rendered"
+	default:
+		msg = fmt.Sprintf("%d expired rendered", s.expiredCount)
+	}
+
+	if viper.GetBool("BuildExpired") {
+		return fmt.Sprintf("%d of ", s.expiredCount) + msg
+	}
+
+	return "0 of " + msg
+}
+
 func getGoMaxProcs() int {
 	if gmp := os.Getenv("GOMAXPROCS"); gmp != "" {
 		if p, err := strconv.Atoi(gmp); err != nil {