Version 0.6.0

- honour capital/mixed cases for ignore case
- consolidate consecutive matches
- database upgrade capability

- case sensitivity option reversed
- removed obsolete WIM handling

- skip empty mapping
- Deletion of mapping
This commit is contained in:
2020-06-06 14:33:06 +02:00
parent ecd6e5c340
commit a29f6486fe
13 changed files with 427 additions and 165 deletions

View File

@@ -12,7 +12,9 @@ Grichelde.COLOR_CODES.NORMAL = _G.NORMAL_FONT_COLOR_CODE or "|cffffd20
Grichelde.COLOR_CODES.HIGHLIGHT = _G.HIGHLIGHT_FONT_COLOR_CODE or "|cffffffff";
Grichelde.COLOR_CODES.RED = _G.RED_FONT_COLOR_CODE or "|cffff2020";
Grichelde.COLOR_CODES.GREEN = _G.GREEN_FONT_COLOR_CODE or "|cff20ff20";
Grichelde.COLOR_CODES.LIGHTGRAY = "|cffC0C0C0";
Grichelde.COLOR_CODES.GRAY = _G.GRAY_FONT_COLOR_CODE or "|cff808080";
Grichelde.COLOR_CODES.DARKGRAY = "|cff404040";
Grichelde.COLOR_CODES.YELLOW = _G.YELLOW_FONT_COLOR_CODE or "|cffffff00";
Grichelde.COLOR_CODES.LIGHTYELLOW = _G.LIGHTYELLOW_FONT_COLOR_CODE or "|cffffff9a";
Grichelde.COLOR_CODES.ORANGE = _G.ORANGE_FONT_COLOR_CODE or "|cffff7f3f";
@@ -24,7 +26,7 @@ local function nilOrEmpty(s)
return s == nil or s:trim() == ""
end
local function spairs(t , orderFunc)
local function spairs(t, orderFunc)
-- collect the keys
local sortedKeys = {}
-- for every non-nil value
@@ -35,6 +37,7 @@ local function spairs(t , orderFunc)
if orderFunc then
Grichelde.functions.tSort(sortedKeys, function(a, b) return orderFunc(sortedKeys, a, b) end)
else
-- lexicographical order
Grichelde.functions.tSort(sortedKeys)
end
@@ -86,6 +89,28 @@ local function tClone(orig)
return copy
end
local function isChar(char)
return Grichelde.functions.find(char, "%a+")
end
local function isNumber(digit)
return Grichelde.functions.find(Grichelde.functions.toString(digit), "%d+")
end
local function isUpper(char)
return Grichelde.functions.isChar(char) and char == Grichelde.functions.toUpper(char)
end
local function isLower(char)
return Grichelde.functions.isChar(char) and char == Grichelde.functions.toLower(char)
end
local function isCapital(word)
return Grichelde.functions.legnth(word) > 1
and Grichelde.functions.isUpper(Grichelde.functions.sub(word,1,1))
and Grichelde.functions.isLower(Grichelde.functions.sub(word,2))
end
-- faster function lookups by mapping to local refs
Grichelde.functions = {}
Grichelde.functions.type = _G.type
@@ -112,8 +137,13 @@ Grichelde.functions.gsub = _G.string.gsub
Grichelde.functions.match = _G.strmatch
Grichelde.functions.join = _G.strjoin
Grichelde.functions.split = _G.strsplit
Grichelde.functions.toLower = _G.strlower
Grichelde.functions.toUpper = _G.strupper
Grichelde.functions.toLower = _G.strlower
Grichelde.functions.isChar = isChar
Grichelde.functions.isNumber = isNumber
Grichelde.functions.isUpper = isUpper
Grichelde.functions.isLower = isLower
Grichelde.functions.isCapital = isCapital
Grichelde.functions.format = _G.string.format
Grichelde.functions.rep = _G.string.rep
Grichelde.functions.trim = _G.strtrim