-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make contact page config more robust
Ensures the contact page is properly rendered when some contact details are missing from config or invalid. Fixes #197
- Loading branch information
Showing
2 changed files
with
18 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{{/* Cloak an e-mail address (first argument) */ -}} | ||
{{- $address_parts := split . "@" -}} | ||
{{- if (eq (len $address_parts) 2) -}} | ||
{{- $user := index $address_parts 0 -}} | ||
{{- $domain := index $address_parts 1 -}} | ||
<span class="cloaked-e-mail" data-user="{{ range $index := seq (sub (len $user) 1) 0 }}{{ substr $user $index 1 }}{{ end }}" data-domain="{{ range $index := seq (sub (len $domain) 1) 0 }}{{ substr $domain $index 1 }}{{ end }}"></span> | ||
{{- else -}} | ||
<span>INVALID E-MAIL ADDRESS</span> | ||
{{- end -}} | ||
{{- /* Dummy comment to strip trailing newline */ -}} |