Browse Source

Added auto-translate parsing.

Auto-translated items will now be bracketed with { }.
Added stripping of double line breaks.
Added converting FFXI's custom in-line-breaks to real line-breaks.
pull/1/head
atom0s 7 years ago
parent
commit
1b0e0d7b0d
  1. 27
      logs.lua

27
logs.lua

@ -25,7 +25,7 @@ @@ -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]'; @@ -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

Loading…
Cancel
Save