From 3891095a21d9355dba0f1391779aa6ed66cc43a6 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Fri, 11 Dec 2020 01:58:39 -0700
Subject: [PATCH 1/2] Update say.dm
---
code/game/say.dm | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/code/game/say.dm b/code/game/say.dm
index a5691ad11f..5b9b045bf0 100644
--- a/code/game/say.dm
+++ b/code/game/say.dm
@@ -96,18 +96,15 @@ 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[html]>")
-
/atom/movable/proc/say_emphasis(input)
- ENCODE_HTML_EPHASIS(input, "\\|", "i", italics)
- ENCODE_HTML_EPHASIS(input, "\\+", "b", bold)
- ENCODE_HTML_EPHASIS(input, "_", "u", underline)
+ 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")
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)
if((input[1] == "!") && (length_char(input) > 1))
From 60f9e97ce5ab6abf474c26e19d69bfe49f966f0a Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Fri, 11 Dec 2020 17:31:27 -0700
Subject: [PATCH 2/2] test
---
code/game/say.dm | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/code/game/say.dm b/code/game/say.dm
index 5b9b045bf0..61dd9c0879 100644
--- a/code/game/say.dm
+++ b/code/game/say.dm
@@ -96,13 +96,14 @@ GLOBAL_LIST_INIT(freqtospan, list(
return "[say_mod(input, message_mode)][spanned ? ", \"[spanned]\"" : ""]"
// Citadel edit [spanned ? ", \"[spanned]\"" : ""]"
+/// Converts specific characters, like +, |, and _ to formatted output.
/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")
+ var/static/regex/italics = regex(@"\|(\S[\w\W]*?\S)\|", "g")
+ input = italics.Replace_char(input, "$1")
+ var/static/regex/bold = regex(@"\+(\S[\w\W]*?\S)\+", "g")
+ input = bold.Replace_char(input, "$1")
+ var/static/regex/underline = regex(@"_(\S[\w\W]*?\S)_", "g")
+ input = underline.Replace_char(input, "$1")
return input
/// Quirky citadel proc for our custom sayverbs to strip the verb out. Snowflakey as hell, say rewrite 3.0 when?