mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-16 20:11:01 +01:00
Dev (#8)
* fixed conf parsing: variables can now be omitted from the config * fix newlines: use CRLF on windows * bump version --------- Co-authored-by: Thomas von Dein <tom@vondein.org>
This commit is contained in:
7
store.go
7
store.go
@@ -22,6 +22,7 @@ import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
tpl "text/template"
|
||||
)
|
||||
@@ -41,7 +42,11 @@ func WriteAd(dir string, ad *Ad, template string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ad.Text = strings.ReplaceAll(ad.Text, "<br/>", "\n")
|
||||
if runtime.GOOS == "windows" {
|
||||
ad.Text = strings.ReplaceAll(ad.Text, "<br/>", "\r\n")
|
||||
} else {
|
||||
ad.Text = strings.ReplaceAll(ad.Text, "<br/>", "\n")
|
||||
}
|
||||
|
||||
tmpl, err := tpl.New("adlisting").Parse(template)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user