From 49afb059bc98eea905b7e2f3c7e8eed89b90f2d4 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Sun, 8 Sep 2024 17:45:25 -0500 Subject: templates/quote: only prefix quoted lines with '>' Prefix all quoted lines with depth > 1 with '>'. Quoted lines of depth 1 are quoted with "> ". This follows conventions of mailing lists which collapse quote depths without spaces. For example: >>> Quote depth 3 > Quote depth 1 >> Quote depth 2 Changelog-changed: Template function `quote` only prefixes with a space if at quote depth 1. Requested-by: Isaac Freund Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- lib/templates/functions.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/templates/functions.go b/lib/templates/functions.go index 0d204b8f..8a415b1f 100644 --- a/lib/templates/functions.go +++ b/lib/templates/functions.go @@ -84,7 +84,11 @@ func quote(text string) string { quoted.WriteString(">\n") continue } - quoted.WriteString("> ") + if strings.HasPrefix(line, ">") { + quoted.WriteString(">") + } else { + quoted.WriteString("> ") + } quoted.WriteString(line) quoted.WriteRune('\n') } -- cgit