Fix flavor text encoding issues

This commit is contained in:
Markolie
2015-08-14 20:17:23 +02:00
parent b3e51226ff
commit 508d1315f6
5 changed files with 19 additions and 4 deletions
+15
View File
@@ -339,4 +339,19 @@ proc/checkhtml(var/t)
/proc/trim_strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN)
return trim(strip_html_properly(input, max_length))
//Used in preferences' SetFlavorText and human's set_flavor verb
//Previews a string of len or less length
/proc/TextPreview(var/string,var/len=40)
if(lentext(string) <= len)
if(!lentext(string))
return "\[...\]"
else
return string
else
return "[copytext_preserve_html(string, 1, 37)]..."
//alternative copytext() for encoded text, doesn't break html entities (&#34; and other)
/proc/copytext_preserve_html(var/text, var/first, var/last)
return html_encode(copytext(html_decode(text), first, last))
+1 -1
View File
@@ -337,7 +337,7 @@ datum/preferences
else
dat += "[flavor_text]"
else
dat += "[copytext(flavor_text, 1, 37)]...<br>"
dat += "[TextPreview(flavor_text, 1, 37)]...<br>"
dat += "<br>"
var/hairname = "Hair"
@@ -848,4 +848,4 @@
set desc = "Sets an extended description of your character's features."
set category = "IC"
flavor_text = sanitize(copytext(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text, 1))
flavor_text = TextPreview((input(usr, "Please enter your new flavour text.", "Flavour text", null) as text, 1))
+1 -1
View File
@@ -241,7 +241,7 @@
set desc = "Sets an extended description of your character's features."
set category = "IC"
flavor_text = sanitize(copytext(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text, 1))
flavor_text = sanitize(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text)
/mob/living/silicon/binarycheck()
return 1
+1 -1
View File
@@ -605,7 +605,7 @@ var/list/slot_equipment_priority = list( \
if(lentext(msg) <= 40)
return "\blue [msg]"
else
return "\blue [copytext(msg, 1, 37)]... <a href='byond://?src=\ref[src];flavor_more=1'>More...</a>"
return "\blue [copytext_preserve_html(msg, 1, 37)]... <a href='byond://?src=\ref[src];flavor_more=1'>More...</a>"
/mob/proc/is_dead()
return stat == DEAD