]> Sergey Matveev's repositories - public-inbox.git/blobdiff - examples/cgit-commit-filter.lua
nntp: use substr to check for trailing CRLF
[public-inbox.git] / examples / cgit-commit-filter.lua
index 73af994828aebcb373a7bdd67cebbe592c1d4017..9857b3c9572a33a0a3e7723f96a0de5e753a6bba 100644 (file)
@@ -1,4 +1,4 @@
--- Copyright (C) 2015-2020 all contributors <meta@public-inbox.org>
+-- Copyright (C) 2015-2021 all contributors <meta@public-inbox.org>
 -- License: GPLv2 or later <https://www.gnu.org/licenses/gpl-2.0.txt>
 -- This commit filter maps a subject line to a search URL of a public-inbox
 -- disclaimer: written by someone who does not know Lua.
@@ -31,11 +31,13 @@ function filter_close()
                if u == nil then
                        html(buffer)
                else
-                       html('<a href="' .. u .. '?x=t&amp;q=')
-                       html_url_arg('"' .. buffer .. '"')
-                       html('"><tt>')
+                       html("<a\ntitle='mail thread'\n")
+                       html('href="' .. u .. '?x=t&amp;q=')
+                       s = string.gsub(buffer, '"', '""')
+                       html_url_arg('"' .. s .. '"')
+                       html('">')
                        html_txt(buffer)
-                       html('</tt></a>')
+                       html('</a>')
                end
        else
                -- pass the body-through as-is