diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index fc00a9dcf3b..865cf6f7384 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -323,7 +323,7 @@ proc/checkhtml(var/t) //This proc strips html properly, but it's not lazy like the other procs. //This means that it doesn't just remove < and > and call it a day. //Also limit the size of the input, if specified. -/proc/strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN) +/proc/strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN, allow_lines = 0) if(!input) return var/opentag = 1 //These store the position of < and > respectively. @@ -345,10 +345,10 @@ proc/checkhtml(var/t) break if(max_length) input = copytext(input,1,max_length) - return sanitize(input) + return sanitize(input, allow_lines ? list("\t" = " ") : list("\n" = " ", "\t" = " ")) -/proc/trim_strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN) - return trim(strip_html_properly(input, max_length)) +/proc/trim_strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN, allow_lines = 0) + return trim(strip_html_properly(input, max_length, allow_lines)) //Used in preferences' SetFlavorText and human's set_flavor verb //Previews a string of len or less length diff --git a/code/defines/procs/announce.dm b/code/defines/procs/announce.dm index 0267bd88d98..7993badfb0e 100644 --- a/code/defines/procs/announce.dm +++ b/code/defines/procs/announce.dm @@ -51,7 +51,7 @@ var/tmp/message_sound = new_sound ? sound(new_sound) : sound if(!msg_sanitized) - message = trim_strip_html_properly(message) + message = trim_strip_html_properly(message, allow_lines = 1) message_title = html_encode(message_title) Message(message, message_title, from)