Fix CRLF vs. LF for slide separators on windows and everything else

This commit is contained in:
Peter 2021-11-15 14:36:36 +01:00
parent fd73f607d6
commit 2cc48cfbb0
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
4 changed files with 19 additions and 4 deletions

View file

@ -18,8 +18,8 @@
<div class="reveal"> <div class="reveal">
<div class="slides"> <div class="slides">
<section data-markdown="/content.md" <section data-markdown="/content.md"
data-separator="^\n{{ .Reveal.HorizontalSeparator }}\n" data-separator="^{{ .Reveal.LineEnding -}}{{ .Reveal.HorizontalSeparator }}{{- .Reveal.LineEnding }}"
data-separator-vertical="^\n{{ .Reveal.VerticalSeparator }}\n" data-separator-vertical="^{{ .Reveal.LineEnding -}}{{ .Reveal.VerticalSeparator }}{{- .Reveal.LineEnding }}"
data-separator-notes="^Note:" data-separator-notes="^Note:"
data-charset="iso-8859-15"> data-charset="iso-8859-15">
</section> </section>
@ -42,8 +42,8 @@
slideNumber: true, slideNumber: true,
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 | trim | quote }},
showSlideNumber: '{{ .Reveal.SlideNumberVisibility }}', showSlideNumber: {{ .Reveal.SlideNumberVisibility | trim | quote }},
slideNumber: '{{ .Reveal.SlideNumberFormat }}', slideNumber: '{{ .Reveal.SlideNumberFormat }}',
markdown: { markdown: {
smartypants: true, smartypants: true,

View file

@ -0,0 +1,8 @@
//go:build !windows
// +build !windows
package rendering
const (
LineEnding string = "\\n"
)

View file

@ -0,0 +1,5 @@
package rendering
const (
LineEnding string = "\\r\\n"
)

View file

@ -32,6 +32,7 @@ var defaultParams = RevealParams{
VerticalSeparator: "---", VerticalSeparator: "---",
SlideNumberVisibility: "all", SlideNumberVisibility: "all",
SlideNumberFormat: "h.v", SlideNumberFormat: "h.v",
LineEnding: LineEnding,
StyleSheets: make([]string, 0), StyleSheets: make([]string, 0),
FilesToMonitor: make([]string, 0), FilesToMonitor: make([]string, 0),
} }
@ -48,6 +49,7 @@ type RevealParams struct {
StyleSheets []string `mapstructure:"stylesheets"` StyleSheets []string `mapstructure:"stylesheets"`
FilesToMonitor []string `mapstructure:"filesToMonitor"` FilesToMonitor []string `mapstructure:"filesToMonitor"`
WorkingDirectory string `mapstructure:"working-dir"` WorkingDirectory string `mapstructure:"working-dir"`
LineEnding string `mapstructure:"-"`
} }
func (params *RevealParams) Load() error { func (params *RevealParams) Load() error {