diff --git a/render.go b/render.go index 72a5ae1..d613832 100644 --- a/render.go +++ b/render.go @@ -242,8 +242,8 @@ func render(w http.ResponseWriter, r *http.Request) { } funcMap := template.FuncMap{ - "BasicFormatting": BasicFormatting, - "SanitizeString": html.EscapeString, + "basicFormatting": basicFormatting, + "sanitizeString": html.EscapeString, } tmpl := template.Must( diff --git a/templates/details.html b/templates/details.html index 415a41b..9037a20 100644 --- a/templates/details.html +++ b/templates/details.html @@ -1,16 +1,16 @@
Published at
- {{.createdAt | SanitizeString}} + {{.createdAt | sanitizeString}}
Kind type
- {{.kindID}} - {{.kindDescription | SanitizeString}} + {{.kindID}} - {{.kindDescription | sanitizeString}}
Nevent
-
{{.nevent | SanitizeString}}
+
{{.nevent | sanitizeString}}
diff --git a/templates/head.html b/templates/head.html index 550d989..d86709f 100644 --- a/templates/head.html +++ b/templates/head.html @@ -1,19 +1,19 @@ {{if eq .type "profile"}} Nostr Public Key {{.npub}} - - - + + + {{ if .metadata.Picture }} - + {{end}} {{ if .metadata.About }} {{end}} @@ -21,45 +21,45 @@ {{ if eq .type "note" }} Nostr Event {{.nevent}} - - - - + + + + {{ if .textImageURL }} - - + + {{ else }} {{ if .image }} - - + + {{end}} {{ if .video }} - - + + {{end}} {{end}} - + {{end}} {{ if eq .type "address" }} - Nostr Address {{.naddr | SanitizeString }} + Nostr Address {{.naddr | sanitizeString }} {{end}} {{ if eq .type "other" }} - Nostr Event {{.kindID }} - {{.kindDescription | SanitizeString }} + Nostr Event {{.kindID }} - {{.kindDescription | sanitizeString }} {{end}} diff --git a/templates/note.html b/templates/note.html index 3467a30..9bff0fb 100644 --- a/templates/note.html +++ b/templates/note.html @@ -10,34 +10,34 @@
- {{.content | SanitizeString | BasicFormatting }} + {{.content | sanitizeString | basicFormatting }}
Author Public key
- {{.npub | SanitizeString}} + {{.npub | sanitizeString}}
diff --git a/templates/other.html b/templates/other.html index fe47194..dd47b5f 100644 --- a/templates/other.html +++ b/templates/other.html @@ -12,7 +12,7 @@
- {{.kindDescription | SanitizeString}} + {{.kindDescription | sanitizeString}}
@@ -21,7 +21,7 @@ {{template "details.html" .}} diff --git a/templates/profile.html b/templates/profile.html index a8a23e1..3046c71 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -10,53 +10,53 @@
- {{.metadata.Name | SanitizeString}} + {{.metadata.Name | sanitizeString}} {{.metadata.DisplayName | SanitizeString}}{{.metadata.DisplayName | sanitizeString}}
- +
Last update:
- {{.createdAt | SanitizeString}} + {{.createdAt | sanitizeString}}
- {{.metadata.Name | SanitizeString}} + {{.metadata.Name | sanitizeString}} {{.metadata.DisplayName | SanitizeString}}{{.metadata.DisplayName | sanitizeString}}
- {{.metadata.Website | SanitizeString}}{{.metadata.Website | sanitizeString}}
-
{{.metadata.About | SanitizeString | BasicFormatting}}
+
{{.metadata.About | sanitizeString | basicFormatting}}
Public key
- {{.npub | SanitizeString}} + {{.npub | sanitizeString}}
NIP-05
- {{.metadata.NIP05 | SanitizeString}} + {{.metadata.NIP05 | sanitizeString}}
LN Address
- {{.metadata.LUD16 | SanitizeString}} + {{.metadata.LUD16 | sanitizeString}}
Last update:
- {{.createdAt | SanitizeString}} + {{.createdAt | sanitizeString}}
diff --git a/utils.go b/utils.go index c1ae2e6..560a3eb 100644 --- a/utils.go +++ b/utils.go @@ -166,19 +166,19 @@ func getPreviewStyle(r *http.Request) string { } } -func BasicFormatting(input string) string { +func basicFormatting(input string) string { lines := strings.Split(input, "\n") var processedLines []string for _, line := range lines { - processedLine := ReplaceURLsWithTags(line) + processedLine := replaceURLsWithTags(line) processedLines = append(processedLines, processedLine) } return strings.Join(processedLines, "
") } -func ReplaceURLsWithTags(line string) string { +func replaceURLsWithTags(line string) string { // Match and replace image URLs with tags imageExtensions := []string{".jpg", ".jpeg", ".png", ".webp", ".gif"}