From d94969d8f669fb2b4c463a0267865379e30ff975 Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Mon, 22 Jan 2024 17:38:21 +0100 Subject: htmlquote: add example using string functions Expand the htmlquote example with a more extensive version that makes an even more concise text by dropping empty lines, leading whitespaces (when the message is centered), and the links and references generated as an addendum. Signed-off-by: Moritz Poldrack --- configurations/htmlquote.md | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/configurations/htmlquote.md b/configurations/htmlquote.md index 2e7d2def..630735f9 100644 --- a/configurations/htmlquote.md +++ b/configurations/htmlquote.md @@ -3,19 +3,45 @@ title: "aerc-wiki: Configurations/HTML quoting in replies" --- Sometimes the email you get only has `text/html`. If you quote reply this, the -default [quoted_reply -template](https://git.sr.ht/~rjarry/aerc/tree/master/item/templates/quoted_reply) -will dump the entire html with all the markup into the quote. You can update -this template to behave differently if replying to html. For example, add the -html filter shipped with aerc to construct a more sensible text to quote: +default [quoted_reply template][quoted_reply] will dump the entire html with +all the markup into the quote. You can update this template to behave +differently if replying to html. For example, add the html filter shipped with +aerc to construct a more sensible text to quote: ``` {{ if eq .OriginalMIMEType "text/html" -}} -{{- trimSignature (exec `~/.local/softwarefromsource/aerc/filters/html` .OriginalText) | quote -}} + {{- trimSignature (exec `~/.local/softwarefromsource/aerc/filters/html` .OriginalText) | quote -}} {{- else -}} -{{- trimSignature .OriginalText | quote -}} + {{- trimSignature .OriginalText | quote -}} {{- end}} ``` +This can be expanded to also properly quote html sent as text/plain and to make +the filtered content more readable by dropping empty lines, links, and leading +whitespace. + +``` +{{ if or + (eq .OriginalMIMEType "text/html") + (contains (toLower .OriginalText) "