{{- $context := . -}} {{- $content := $context.Content -}} {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} {{- $empty := eq (len $content) 0 -}} {{- $content = $content | replaceRE "

" "
" | replaceRE "

\n

" "
" | replaceRE "

" "
" | -}} {{- $blockquoteFooters := findRE `\n

(–|—).*

` .Content -}} {{- range $blockquoteFooter := $blockquoteFooters -}} {{- $blockquoteFooterFixed := $blockquoteFooter | replaceRE "\n

" "

" | replaceRE "

" "
" | -}} {{- $content = $content | replaceRE $blockquoteFooter $blockquoteFooterFixed -}} {{- end -}} {{- $blockquoteFooters = findRE `(?s)\n

(–|—).*

` .Content -}} {{- range $blockquoteFooter := $blockquoteFooters -}} {{- $blockquoteFooterFixed := $blockquoteFooter | replaceRE "\n

" "

" | -}} {{- $content = $content | replaceRE $blockquoteFooter $blockquoteFooterFixed -}} {{- end -}} {{- if $empty -}} {{- $content = "This message contains no content." -}} {{- end -}} {{- if $expired -}} {{- $content = "This message has expired." -}} {{- end -}} {{- return $content -}}