mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
+Abkürzungen
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package functions
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"regexp"
|
||||
@@ -19,6 +20,15 @@ func Safe(s string) template.HTML {
|
||||
return template.HTML(s)
|
||||
}
|
||||
|
||||
func SafeJS(s any) template.JS {
|
||||
b, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
return template.JS("{}")
|
||||
}
|
||||
|
||||
return template.JS(b)
|
||||
}
|
||||
|
||||
func ReplaceSlashParen(s string) string {
|
||||
return strings.ReplaceAll(s, "/)", "<p>")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user