some more header and footer work
This commit is contained in:
parent
f9ef42b960
commit
e358ea1267
@ -17,7 +17,7 @@
|
||||
</script>
|
||||
<body>
|
||||
<div class="chapter" id="{{.Id}}">
|
||||
<h2>{{.Name}}</h2>
|
||||
<h2><a href="./">Go by Example</a>: {{.Name}}</h2>
|
||||
{{range .Segs}}
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
@ -34,6 +34,14 @@
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
{{if .NextChapter}}
|
||||
<p class="next">
|
||||
Next example: <a href="{{.NextChapter.Id}}">{{.NextChapter.Name}}</a>
|
||||
</p>
|
||||
{{end}}
|
||||
<p class="footer">
|
||||
Follow <a href="https://twitter.com/gobyexample">@gobyexample</a> for updates. <a href="https://github.com/mmcgrana/gobyexample/blob/master/src/{{.Id}}/{{.Id}}.go">Source</a> & <a href="https://github.com/mmcgrana/gobyexample#license">license</a>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -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;
|
||||
|
@ -126,6 +126,7 @@ type Seg struct {
|
||||
type Chapter struct {
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user