liquid_feedback_frontend
diff env/format/text_with_links.lua @ 1725:4a5a79a37db1
Render links in unit and area description, updated layout of unit and area box
author | bsw |
---|---|
date | Tue Sep 28 09:43:58 2021 +0200 (2021-09-28) |
parents | |
children | c06c22e8ee35 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/env/format/text_with_links.lua Tue Sep 28 09:43:58 2021 +0200 1.3 @@ -0,0 +1,7 @@ 1.4 +function format.text_with_links(value) 1.5 + value = encode.html(value) 1.6 + value = string.gsub(value, "http[^%s:]*://[^%s]+", function(match) 1.7 + return "<a href=\"" .. match .. "\">" .. match .. "</a>" 1.8 + end) 1.9 + return value 1.10 +end