webmcp
diff framework/env/encode/html_newlines.lua @ 0:9fdfb27f8e67
Version 1.0.0
author | jbe/bsw |
---|---|
date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/framework/env/encode/html_newlines.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,13 @@ 1.4 +--[[-- 1.5 +text_with_br_tags = -- text with <br/> tags 1.6 +encode.html_newlines( 1.7 + text_with_lf_control_characters -- text with LF control characters 1.8 +) 1.9 + 1.10 +This function transforms LF control characters (\n) into <br/> tags. 1.11 + 1.12 +--]]-- 1.13 + 1.14 +function encode.html_newlines(text) 1.15 + return (string.gsub(text, '\n', '<br/>')) 1.16 +end