From e358ea12679d3d6bba7a1abbd3e76c0c206d0166 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Tue, 9 Oct 2012 19:21:52 -0700 Subject: [PATCH] some more header and footer work --- template/chapter.tmpl | 10 +++++++++- template/site.css | 10 ++++++++++ tool/generate.go | 10 ++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/template/chapter.tmpl b/template/chapter.tmpl index d867c63..493e83f 100644 --- a/template/chapter.tmpl +++ b/template/chapter.tmpl @@ -17,7 +17,7 @@
-

{{.Name}}

+

Go by Example: {{.Name}}

{{range .Segs}} @@ -34,6 +34,14 @@
{{end}} + {{if .NextChapter}} +

+ Next example: {{.NextChapter.Name}} +

+ {{end}} +
diff --git a/template/site.css b/template/site.css index e0cf91f..74fe4c8 100644 --- a/template/site.css +++ b/template/site.css @@ -60,6 +60,9 @@ h2 { line-height: 40px; margin-top: 40px; } +h2 a { + text-decoration: none; +} div.chapter { width: 900px; min-width: 900px; @@ -71,6 +74,13 @@ div.chapter { div.chapter table { margin-bottom: 20px; } +div.chapter p.footer { + margin-top: 20px; + color: grey; +} +div.chapter p.footer a, div.chapter p.footer a:visited { + color: grey; +} div#intro { width: 420px; min-width: 420px; diff --git a/tool/generate.go b/tool/generate.go index aa3a3c7..4b89377 100644 --- a/tool/generate.go +++ b/tool/generate.go @@ -124,8 +124,9 @@ type Seg struct { } type Chapter struct { - Id, Name string - Segs [][]*Seg + Id, Name string + Segs [][]*Seg + NextChapter *Chapter } func parseSegs(sourcePath string) []*Seg { @@ -208,6 +209,11 @@ func parseChapters() []*Chapter { chapters = append(chapters, &chapter) } } + for i, chapter := range chapters { + if i < (len(chapters) - 1) { + chapter.NextChapter = chapters[i+1] + } + } return chapters }