summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Campbell <noahcampbell@gmail.com>2013-08-31 21:13:04 -0700
committerNoah Campbell <noahcampbell@gmail.com>2013-09-03 20:00:21 -0700
commit13d2c552060a2e0339e1ac7c6a523f8837d77e09 (patch)
tree408f825248923bece96ad8bebb024cb1bd58aa52
parent79d9f82e79014fffabaedd34a3997475967508f6 (diff)
Adding Planner
-rw-r--r--hugolib/planner.go9
-rw-r--r--hugolib/site.go24
-rw-r--r--hugolib/site_show_plan_test.go14
3 files changed, 43 insertions, 4 deletions
diff --git a/hugolib/planner.go b/hugolib/planner.go
new file mode 100644
index 000000000..5b1d42327
--- /dev/null
+++ b/hugolib/planner.go
@@ -0,0 +1,9 @@
+package hugolib
+
+import (
+ "io"
+)
+
+func (s *Site) ShowPlan(out io.Writer) (err error) {
+ return
+}
diff --git a/hugolib/site.go b/hugolib/site.go
index 5bbfc45cd..4fae4ebbd 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -47,6 +47,23 @@ func PrintErr(str string, a ...interface{}) {
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 @@ func (s *Site) Build() (err error) {
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
}
diff --git a/hugolib/site_show_plan_test.go b/hugolib/site_show_plan_test.go
new file mode 100644
index 000000000..de9d7363e
--- /dev/null
+++ b/hugolib/site_show_plan_test.go
@@ -0,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)
+ }
+}