diff --git a/cmd/present/local.go b/cmd/present/local.go index d968553a..260cacbb 100644 --- a/cmd/present/local.go +++ b/cmd/present/local.go @@ -31,6 +31,7 @@ var ( func main() { flag.BoolVar(&present.PlayEnabled, "play", true, "enable playground (permit execution of arbitrary user code)") + flag.BoolVar(&present.NotesEnabled, "notes", false, "enable presenter notes (press 'N' from the browser to display them)") flag.Parse() if *basePath == "" { @@ -85,6 +86,9 @@ func main() { } log.Printf("Open your web browser and visit %s", origin.String()) + if present.NotesEnabled { + log.Println("Notes are enabled, press 'N' from the browser to display them.") + } log.Fatal(http.Serve(ln, nil)) } diff --git a/present/code.go b/present/code.go index 6e1a9cc4..edf2ee42 100644 --- a/present/code.go +++ b/present/code.go @@ -15,7 +15,8 @@ import ( "strings" ) -// Is the playground available? +// PlayEnabled specifies whether runnable playground snippets should be +// displayed in the present user interface. var PlayEnabled = false // TODO(adg): replace the PlayEnabled flag with something less spaghetti-like. @@ -23,6 +24,10 @@ var PlayEnabled = false // value that contains various global metadata required when rendering // templates. +// NotesEnabled specifies whether presenter notes should be displayed in the +// present user interface. +var NotesEnabled = false + func init() { Register("code", parseCode) Register("play", parseCode) diff --git a/present/parse.go b/present/parse.go index 39d44f35..1cb0402e 100644 --- a/present/parse.go +++ b/present/parse.go @@ -35,9 +35,10 @@ func Template() *template.Template { func (d *Doc) Render(w io.Writer, t *template.Template) error { data := struct { *Doc - Template *template.Template - PlayEnabled bool - }{d, t, PlayEnabled} + Template *template.Template + PlayEnabled bool + NotesEnabled bool + }{d, t, PlayEnabled, NotesEnabled} return t.ExecuteTemplate(w, "root", data) }