mirror of
https://github.com/golang/go
synced 2024-11-18 10:04:43 -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;
|
||||
}
|
||||
|
||||
.pagenumber {
|
||||
color: #8c8c8c;
|
||||
font-size: 75%;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
/* Code */
|
||||
div.code {
|
||||
outline: 0px solid transparent;
|
||||
|
@ -62,8 +62,9 @@
|
||||
{{else}}
|
||||
<h2>{{$s.Title}}</h2>
|
||||
{{end}}
|
||||
<span class="pagenumber">{{pagenum $s 1}}</span>
|
||||
</article>
|
||||
<!-- end of slide {{$i}} -->
|
||||
<!-- end of slide {{$s.Number}} -->
|
||||
{{end}}{{/* of Slide block */}}
|
||||
|
||||
<article>
|
||||
|
@ -168,8 +168,17 @@ func renderElem(t *template.Template, e Elem) (template.HTML, error) {
|
||||
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() {
|
||||
funcs["elem"] = renderElem
|
||||
funcs["pagenum"] = pageNum
|
||||
}
|
||||
|
||||
// execTemplate is a helper to execute a template and return the output as a
|
||||
|
Loading…
Reference in New Issue
Block a user