diff --git a/cmd/present/static/styles.css b/cmd/present/static/styles.css
index 2d8d3544d1..bc525591d3 100644
--- a/cmd/present/static/styles.css
+++ b/cmd/present/static/styles.css
@@ -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;
diff --git a/cmd/present/templates/slides.tmpl b/cmd/present/templates/slides.tmpl
index 37484000c0..03945d28aa 100644
--- a/cmd/present/templates/slides.tmpl
+++ b/cmd/present/templates/slides.tmpl
@@ -62,8 +62,9 @@
{{else}}
{{$s.Title}}
{{end}}
+ {{pagenum $s 1}}
-
+
{{end}}{{/* of Slide block */}}
diff --git a/present/parse.go b/present/parse.go
index d7289dbaf2..dd0f00b27b 100644
--- a/present/parse.go
+++ b/present/parse.go
@@ -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