From 2cc48cfbb061ab82e1698e6966bd1c4aebfef943 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Mon, 15 Nov 2021 14:36:36 +0100 Subject: [PATCH] Fix CRLF vs. LF for slide separators on windows and everything else --- assets/template/reveal-markdown.tmpl | 8 ++++---- internal/app/rendering/const_other.go | 8 ++++++++ internal/app/rendering/const_windows.go | 5 +++++ internal/app/rendering/reveal_params.go | 2 ++ 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 internal/app/rendering/const_other.go create mode 100644 internal/app/rendering/const_windows.go diff --git a/assets/template/reveal-markdown.tmpl b/assets/template/reveal-markdown.tmpl index cb1228b..6cce0d6 100644 --- a/assets/template/reveal-markdown.tmpl +++ b/assets/template/reveal-markdown.tmpl @@ -18,8 +18,8 @@
@@ -42,8 +42,8 @@ slideNumber: true, hash: true, transition: '{{ .Reveal.Transition }}', // none/fade/slide/convex/concave/zoom - navigationMode: '{{ .Reveal.NavigationMode }}', - showSlideNumber: '{{ .Reveal.SlideNumberVisibility }}', + navigationMode: {{ .Reveal.NavigationMode | trim | quote }}, + showSlideNumber: {{ .Reveal.SlideNumberVisibility | trim | quote }}, slideNumber: '{{ .Reveal.SlideNumberFormat }}', markdown: { smartypants: true, diff --git a/internal/app/rendering/const_other.go b/internal/app/rendering/const_other.go new file mode 100644 index 0000000..020ad88 --- /dev/null +++ b/internal/app/rendering/const_other.go @@ -0,0 +1,8 @@ +//go:build !windows +// +build !windows + +package rendering + +const ( + LineEnding string = "\\n" +) diff --git a/internal/app/rendering/const_windows.go b/internal/app/rendering/const_windows.go new file mode 100644 index 0000000..62a3084 --- /dev/null +++ b/internal/app/rendering/const_windows.go @@ -0,0 +1,5 @@ +package rendering + +const ( + LineEnding string = "\\r\\n" +) diff --git a/internal/app/rendering/reveal_params.go b/internal/app/rendering/reveal_params.go index 9c6bd7a..1b99f70 100644 --- a/internal/app/rendering/reveal_params.go +++ b/internal/app/rendering/reveal_params.go @@ -32,6 +32,7 @@ var defaultParams = RevealParams{ VerticalSeparator: "---", SlideNumberVisibility: "all", SlideNumberFormat: "h.v", + LineEnding: LineEnding, StyleSheets: make([]string, 0), FilesToMonitor: make([]string, 0), } @@ -48,6 +49,7 @@ type RevealParams struct { StyleSheets []string `mapstructure:"stylesheets"` FilesToMonitor []string `mapstructure:"filesToMonitor"` WorkingDirectory string `mapstructure:"working-dir"` + LineEnding string `mapstructure:"-"` } func (params *RevealParams) Load() error {