some more header and footer work
This commit is contained in:
parent
f9ef42b960
commit
e358ea1267
@ -17,7 +17,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<body>
|
<body>
|
||||||
<div class="chapter" id="{{.Id}}">
|
<div class="chapter" id="{{.Id}}">
|
||||||
<h2>{{.Name}}</h2>
|
<h2><a href="./">Go by Example</a>: {{.Name}}</h2>
|
||||||
{{range .Segs}}
|
{{range .Segs}}
|
||||||
<table cellspacing="0" cellpadding="0">
|
<table cellspacing="0" cellpadding="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -34,6 +34,14 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{end}}
|
{{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>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -60,6 +60,9 @@ h2 {
|
|||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
}
|
}
|
||||||
|
h2 a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
div.chapter {
|
div.chapter {
|
||||||
width: 900px;
|
width: 900px;
|
||||||
min-width: 900px;
|
min-width: 900px;
|
||||||
@ -71,6 +74,13 @@ div.chapter {
|
|||||||
div.chapter table {
|
div.chapter table {
|
||||||
margin-bottom: 20px;
|
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 {
|
div#intro {
|
||||||
width: 420px;
|
width: 420px;
|
||||||
min-width: 420px;
|
min-width: 420px;
|
||||||
|
@ -124,8 +124,9 @@ type Seg struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Chapter struct {
|
type Chapter struct {
|
||||||
Id, Name string
|
Id, Name string
|
||||||
Segs [][]*Seg
|
Segs [][]*Seg
|
||||||
|
NextChapter *Chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseSegs(sourcePath string) []*Seg {
|
func parseSegs(sourcePath string) []*Seg {
|
||||||
@ -208,6 +209,11 @@ func parseChapters() []*Chapter {
|
|||||||
chapters = append(chapters, &chapter)
|
chapters = append(chapters, &chapter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for i, chapter := range chapters {
|
||||||
|
if i < (len(chapters) - 1) {
|
||||||
|
chapter.NextChapter = chapters[i+1]
|
||||||
|
}
|
||||||
|
}
|
||||||
return chapters
|
return chapters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user