blob: f206a034c63182a98cde4ab6086be4c1156f8b5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
{{- $pageContext := . -}}
{{- $content := $pageContext.Content -}}
{{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}}
{{-
$content = $content |
replaceRE "<p><figure>" "<figure>" |
replaceRE "<p>\n<figure>" "<figure>" |
replaceRE "</figure></p>" "</figure>" |
-}}
{{- $brokenBlockquotes := findRE `(?sU)</blockquote>\n<p>(–|—).*</p>` .Content -}}
{{- range $brokenBlockquote := $brokenBlockquotes -}}
{{- $fixedBlockquote := $brokenBlockquote |
replaceRE "</blockquote>\n<p>" "<footer><cite>" |
replaceRE "</p>" "</cite></footer></blockquote>" |
-}}
{{- $content = replace $content $brokenBlockquote $fixedBlockquote -}}
{{- end -}}
{{- if not $content -}}
{{- $content = "This message contains no content." -}}
{{- end -}}
{{- if $expired -}}
{{- $content = "This message has expired." -}}
{{- end -}}
{{- return $content -}}
|