feat: added switches to configure slide numbers

This commit is contained in:
Peter 2019-06-03 15:42:16 +02:00
parent 667bc0e2cb
commit bbbbb0b141
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
3 changed files with 26 additions and 16 deletions

View file

@ -37,6 +37,8 @@
hash: true, hash: true,
transition: '{{ .Reveal.Transition }}', // none/fade/slide/convex/concave/zoom transition: '{{ .Reveal.Transition }}', // none/fade/slide/convex/concave/zoom
navigationMode: '{{ .Reveal.NavigationMode }}', navigationMode: '{{ .Reveal.NavigationMode }}',
showSlideNumber: '{{ .Reveal.SlideNumberVisibility }}',
slideNumber: '{{ .Reveal.SlideNumberFormat }}',
markdown: { markdown: {
smartypants: true, smartypants: true,
smartLists: true smartLists: true

View file

@ -32,14 +32,17 @@ const (
) )
var ( var (
cfgFile string cfgFile string
theme string theme string
codeTheme string codeTheme string
transition string transition string
navigationMode string navigationMode string
horizontalSeparator string horizontalSeparator string
verticalSeparator string verticalSeparator string
rootCmd = &cobra.Command{ showSlideNumbers bool
slideNumberVisibility string
slideNumberFormat string
rootCmd = &cobra.Command{
Use: "goveal", Use: "goveal",
Short: "goveal is a small reveal.js server", Short: "goveal is a small reveal.js server",
Long: `goveal is a single static binary to host your reveal.js based markdown presentation. Long: `goveal is a single static binary to host your reveal.js based markdown presentation.
@ -69,7 +72,8 @@ func init() {
rootCmd.PersistentFlags().StringVar(&horizontalSeparator, "horizontal-separator", "===", "horizontal separator in slides") rootCmd.PersistentFlags().StringVar(&horizontalSeparator, "horizontal-separator", "===", "horizontal separator in slides")
rootCmd.PersistentFlags().StringVar(&verticalSeparator, "vertical-separator", "---", "vertical separator in slides") rootCmd.PersistentFlags().StringVar(&verticalSeparator, "vertical-separator", "---", "vertical separator in slides")
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.go-reveal-slides.yaml)") rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.go-reveal-slides.yaml)")
rootCmd.PersistentFlags().StringVar(&slideNumberVisibility, "slide-number-visibility", "all", "where should slide numbers be visible ['all', 'speaker', 'print']")
rootCmd.PersistentFlags().StringVar(&slideNumberFormat, "slide-number-format", "h.v", "Format of the slide number ['h.v', 'h/v', 'c', 'c/t']")
} }
func initLogging() { func initLogging() {

View file

@ -19,13 +19,15 @@ import (
) )
type RevealParams struct { type RevealParams struct {
Theme string Theme string
CodeTheme string CodeTheme string
Transition string Transition string
NavigationMode string NavigationMode string
HorizontalSeparator string HorizontalSeparator string
VerticalSeparator string VerticalSeparator string
StyleSheets []string SlideNumberVisibility string
SlideNumberFormat string
StyleSheets []string
} }
func (params *RevealParams) Load() { func (params *RevealParams) Load() {
@ -36,4 +38,6 @@ func (params *RevealParams) Load() {
params.HorizontalSeparator = viper.GetString("horizontal-separator") params.HorizontalSeparator = viper.GetString("horizontal-separator")
params.VerticalSeparator = viper.GetString("vertical-separator") params.VerticalSeparator = viper.GetString("vertical-separator")
params.StyleSheets = viper.GetStringSlice("stylesheets") params.StyleSheets = viper.GetStringSlice("stylesheets")
params.SlideNumberVisibility = viper.GetString("slide-number-visibility")
params.SlideNumberFormat = viper.GetString("slide-number-format")
} }