mirror of
https://github.com/golang/go
synced 2024-11-18 10:54:40 -07:00
cmd/present: display slide numbers
Fixes golang/go#5331 Change-Id: Iddd45452959823b2e8e3f9b4236a9a9a3968d35f Reviewed-on: https://go-review.googlesource.com/97058 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
parent
1c0c7a8cce
commit
5e86cd2985
@ -415,6 +415,14 @@ p.link {
|
|||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagenumber {
|
||||||
|
color: #8c8c8c;
|
||||||
|
font-size: 75%;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Code */
|
/* Code */
|
||||||
div.code {
|
div.code {
|
||||||
outline: 0px solid transparent;
|
outline: 0px solid transparent;
|
||||||
|
@ -62,8 +62,9 @@
|
|||||||
{{else}}
|
{{else}}
|
||||||
<h2>{{$s.Title}}</h2>
|
<h2>{{$s.Title}}</h2>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<span class="pagenumber">{{pagenum $s 1}}</span>
|
||||||
</article>
|
</article>
|
||||||
<!-- end of slide {{$i}} -->
|
<!-- end of slide {{$s.Number}} -->
|
||||||
{{end}}{{/* of Slide block */}}
|
{{end}}{{/* of Slide block */}}
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
@ -168,8 +168,17 @@ func renderElem(t *template.Template, e Elem) (template.HTML, error) {
|
|||||||
return execTemplate(t, e.TemplateName(), data)
|
return execTemplate(t, e.TemplateName(), data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pageNum derives a page number from a section.
|
||||||
|
func pageNum(s Section, offset int) int {
|
||||||
|
if len(s.Number) == 0 {
|
||||||
|
return offset
|
||||||
|
}
|
||||||
|
return s.Number[0] + offset
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
funcs["elem"] = renderElem
|
funcs["elem"] = renderElem
|
||||||
|
funcs["pagenum"] = pageNum
|
||||||
}
|
}
|
||||||
|
|
||||||
// execTemplate is a helper to execute a template and return the output as a
|
// execTemplate is a helper to execute a template and return the output as a
|
||||||
|
Loading…
Reference in New Issue
Block a user