diff --git a/logs.lua b/logs.lua index 51a8060..3215f87 100644 --- a/logs.lua +++ b/logs.lua @@ -25,7 +25,7 @@ _addon.author = 'atom0s'; _addon.name = 'Logs'; -_addon.version = '3.0.0'; +_addon.version = '3.0.1'; require 'common' @@ -40,12 +40,35 @@ local timestamp = '[%H:%M:%S]'; -- desc: Cleans a string of auto-translate and color tags. --------------------------------------------------------------------------------------------------- local function clean_str(str) + -- Parse auto-translate tags.. + str = ParseAutoTranslate(str, true); + -- Strip the string of color tags.. str = (str:gsub('[' .. string.char(0x1E, 0x1F, 0x7F) .. '].', '')); -- Strip the string of auto-translate tags.. - str = (str:gsub(string.char(0xEF) .. '[' .. string.char(0x27, 0x28) .. ']', '')); + str = (str:gsub(string.char(0xEF) .. '[' .. string.char(0x27) .. ']', '{')); + str = (str:gsub(string.char(0xEF) .. '[' .. string.char(0x28) .. ']', '}')); + -- Trim linebreaks from end of strings.. + while true do + local hasN = str:endswith('\n'); + local hasR = str:endswith('\r'); + if (hasN or hasR) then + if (hasN) then + str = str:trimend('\n'); + end + if (hasR) then + str = str:trimend('\r'); + end + else + break; + end + end + + -- Convert mid-linebreaks to real linebreaks.. + str = (str:gsub(string.char(0x07), '\n')); + return str; end