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

@ -39,6 +39,9 @@ var (
navigationMode string navigationMode string
horizontalSeparator string horizontalSeparator string
verticalSeparator string verticalSeparator string
showSlideNumbers bool
slideNumberVisibility string
slideNumberFormat string
rootCmd = &cobra.Command{ rootCmd = &cobra.Command{
Use: "goveal", Use: "goveal",
Short: "goveal is a small reveal.js server", Short: "goveal is a small reveal.js server",
@ -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

@ -25,6 +25,8 @@ type RevealParams struct {
NavigationMode string NavigationMode string
HorizontalSeparator string HorizontalSeparator string
VerticalSeparator string VerticalSeparator string
SlideNumberVisibility string
SlideNumberFormat string
StyleSheets []string StyleSheets []string
} }
@ -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")
} }