shithub: hugo

Download patch

ref: 13d2c552060a2e0339e1ac7c6a523f8837d77e09
parent: 79d9f82e79014fffabaedd34a3997475967508f6
author: Noah Campbell <[email protected]>
date: Sat Aug 31 17:13:04 EDT 2013

Adding Planner

--- /dev/null
+++ b/hugolib/planner.go
@@ -1,0 +1,9 @@
+package hugolib
+
+import (
+	"io"
+)
+
+func (s *Site) ShowPlan(out io.Writer) (err error) {
+	return
+}
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -47,6 +47,23 @@
 	fmt.Fprintln(os.Stderr, str, a)
 }
 
+// Site contains all the information relevent for constructing a static
+// site.  The basic flow of information is as follows:
+//
+// 1. A list of Files is parsed and then converted into Pages.
+//
+// 2. Pages contain sections (based on the file they were generated from),
+//    aliases and slugs (included in a pages frontmatter) which are the
+//		various targets that will get generated.  There will be canonical
+//		listing.
+//
+// 3. Indexes are created via configuration and will present some aspect of
+//    the final page and typically a perm url.
+//
+// 4. All Pages are passed through a template based on their desired
+// 		layout based on numerous different elements.
+//
+// 5. The entire collection of files is written to disk.
 type Site struct {
 	Config     Config
 	Pages      Pages
@@ -85,10 +102,9 @@
 		return
 	}
 	if err = s.Render(); err != nil {
-		fmt.Printf("Error rendering site: %s\n", err)
-		fmt.Printf("Available templates:")
-		for _, tpl := range s.Tmpl.Templates() {
-			fmt.Printf("\t%s\n", tpl.Name())
+		fmt.Printf("Error rendering site: %s\nAvailable templates:\n", err)
+		for _, template := range s.Tmpl.Templates() {
+			fmt.Printf("\t%s\n", template.Name())
 		}
 		return
 	}
--- /dev/null
+++ b/hugolib/site_show_plan_test.go
@@ -1,0 +1,14 @@
+package hugolib
+
+import (
+	"bytes"
+	"testing"
+)
+
+func TestDegenerateNoTarget(t *testing.T) {
+	s := new(Site)
+	out := new(bytes.Buffer)
+	if err := s.ShowPlan(out); err != nil {
+		t.Errorf("ShowPlan unexpectedly returned an error: %s", err)
+	}
+}