From 9866f19eb348736a1a5f1e24f08a2f938503d73c Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 8 Jun 2020 11:18:24 -0700 Subject: [PATCH] Update code/game/say.dm Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> --- code/game/say.dm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/code/game/say.dm b/code/game/say.dm index da8ecf5a7e..35a1b1d072 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -96,15 +96,18 @@ GLOBAL_LIST_INIT(freqtospan, list( return "[say_mod(input, message_mode)][spanned ? ", \"[spanned]\"" : ""]" // Citadel edit [spanned ? ", \"[spanned]\"" : ""]" +#define ENCODE_HTML_EPHASIS(input, char, html, varname) \ + var/static/regex/##varname = regex("[char]{2}(.+?)[char]{2}", "g");\ + input = varname.Replace_char(input, "<[html]>$1") + /atom/movable/proc/say_emphasis(input) - var/static/regex/italics = regex("\\|(?=\\S)(.*?)(?=\\S)\\|", "g") - input = replacetext_char(input, italics, "$1") - var/static/regex/bold = regex("\\+(?=\\S)(.*?)(?=\\S)\\+", "g") - input = replacetext_char(input, bold, "$1") - var/static/regex/underline = regex("_(?=\\S)(.*?)(?=\\S)_", "g") - input = replacetext_char(input, underline, "$1") + ENCODE_HTML_EPHASIS(input, "\\|", "i", italics) + ENCODE_HTML_EPHASIS(input, "\\+", "b", bold) + ENCODE_HTML_EPHASIS(input, "_", "u", underline) return input +#undef ENCODE_HTML_EPHASIS + /// Quirky citadel proc for our custom sayverbs to strip the verb out. Snowflakey as hell, say rewrite 3.0 when? /atom/movable/proc/quoteless_say_quote(input, list/spans = list(speech_span), message_mode) var/pos = findtext(input, "*")