liquid_feedback_frontend
diff env/format/text_with_links.lua @ 1843:b01d9920371b
merge
author | jbe |
---|---|
date | Thu Feb 03 15:57:22 2022 +0100 (2022-02-03) |
parents | c06c22e8ee35 |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/env/format/text_with_links.lua Thu Feb 03 15:57:22 2022 +0100 1.3 @@ -0,0 +1,8 @@ 1.4 +function format.text_with_links(value) 1.5 + value = encode.html(value) 1.6 + value = encode.html_newlines(value) 1.7 + value = string.gsub(value, "http[^%s:]*://[^%s]+", function(match) 1.8 + return "<a href=\"" .. match .. "\">" .. match .. "</a>" 1.9 + end) 1.10 + return value 1.11 +end