Restored revision 1220487642 by Thisasia (talk)
[TD]local current = values[/TD]
[TR]
[TD]Line 695:[/TD]
[TD]Line 693:[/TD]
[/TR]
[TR]
[TD]local value = entry.value[/TD]
[TD]local value = entry.value[/TD]
[/TR]
[TR]
[TD]local modified_key = key:gsub("^[%d]*", "")[/TD]
[TD]local modified_key = key:gsub("^[%d]*", "")[/TD]
[/TR]
[TR]
[TD]local found_alpha = false[/TD]
[TD]local found_alpha =false[/TD]
[/TR]
[TR]
[TD] for i = 1, #modified_key do[/TD]
[TD]for i = 1, #modified_key do[/TD]
[/TR]
[TR]
[TD] if modified_key:sub(i, i):match("%a") then[/TD]
[TD]if modified_key:sub(i, i):match("%a") then[/TD]
[/TR]
[TR]
[TD] modified_key = modified_key:sub(1, i - 1) .. modified_key:sub(i, i):upper() .. modified_key:sub(i + 1)[/TD]
[TD]modified_key = modified_key:sub(1, i - 1) .. modified_key:sub(i, i):upper() .. modified_key:sub(i + 1)[/TD]
[/TR]
[TR]
[TD] found_alpha = true[/TD]
[TD]found_alpha = true[/TD]
[/TR]
[TR]
[TD] break[/TD]
[TD]break[/TD]
[/TR]
[TR]
[TD] end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD] end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD] if not found_alpha then[/TD]
[TD]if not found_alpha then[/TD]
[/TR]
[TR]
[TD] modified_key = modified_key:gsub("^.", string.upper, 5)[/TD]
[TD]modified_key = modified_key:gsub("^.", string.upper, 5)[/TD]
[/TR]
[TR]
[TD] end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD] if modified_key:match(".*%*$") and not matchedKeys[modified_key] then[/TD]
[TD]if modified_key:match(".*%*$") and not matchedKeys[modified_key] then[/TD]
[/TR]
[TR]
[TD] for _, val in pairs(args) do[/TD]
[TD] for _, val in pairs(args) do[/TD]
[/TR]
[TR]
[TD]if val == value and val ~= "" then[/TD]
[TD]if val == value and val ~= "" then[/TD]
[/TR]
[TR]
[TD]local alreadyAdded = string.match(output, val:gsub("^%l", string.upper))[/TD]
[TD]local alreadyAdded = string.match(output, val:gsub("^%l", string.upper))[/TD]
[/TR]
[TR]
[TD]if not alreadyAdded then[/TD]
[TD]if not alreadyAdded then[/TD]
[/TR]
[TR]
[TD]local bg_style = 'background-color:' .. (args[key .. "bg"] or "") .. ';'[/TD]
[TD]output = output .. '<tr><th style="' .. (args.style or "") .. '; background:blac;color:whit ;font-size:16px; text-align:center; background-color:; color:' .. (args.cl or "") .. '; font-weight:bold;">' .. val:gsub("^%l", string.upper) .. '</th>\n</tr>\n'[/TD]
[/TR]
[TR]
[TD]output = output .. '<tr><th style="' .. (args.style or "") .. '; color:' .. (args.cl or "") .. '; font-size:16px; text-align:center; ' .. bg_style .. ' font-weight:bold;">' .. val:gsub("^%l", string.upper) .. '</th></tr>\n'[/TD]
[/TR]
[TR]
[TD]matchedKeys[modified_key] = true[/TD]
[TD]matchedKeys[modified_key] = true[/TD]
[/TR]
[TR]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]-- Output the result[/TD]
[/TR]
[TR]
[TD]print(output)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]--[[[/TD]
[TD]--[[[/TD]
[/TR]
Okumaya devam et...
← Previous revision | Revision as of 02:31, 24 April 2024 |
Line 670: | Line 670: |
]] | ]] |
local output = "" | |
local values = {} | local values = {} |
for key, value in pairs(args) do | for key, value in pairs(args) do |
Line 679: | Line 677: |
end | end |
-- Insertion Sort algorithm | --Insertion Sort algorithm |
for i = 2, #values do | for i = 2, #values do |
local current = values |
[TD]local current = values[/TD]
[TR]
[TD]Line 695:[/TD]
[TD]Line 693:[/TD]
[/TR]
[TR]
[TD]local value = entry.value[/TD]
[TD]local value = entry.value[/TD]
[/TR]
[TR]
[TD]local modified_key = key:gsub("^[%d]*", "")[/TD]
[TD]local modified_key = key:gsub("^[%d]*", "")[/TD]
[/TR]
[TR]
[TD]local found_alpha = false[/TD]
[TD]local found_alpha =false[/TD]
[/TR]
[TR]
[TD] for i = 1, #modified_key do[/TD]
[TD]for i = 1, #modified_key do[/TD]
[/TR]
[TR]
[TD] if modified_key:sub(i, i):match("%a") then[/TD]
[TD]if modified_key:sub(i, i):match("%a") then[/TD]
[/TR]
[TR]
[TD] modified_key = modified_key:sub(1, i - 1) .. modified_key:sub(i, i):upper() .. modified_key:sub(i + 1)[/TD]
[TD]modified_key = modified_key:sub(1, i - 1) .. modified_key:sub(i, i):upper() .. modified_key:sub(i + 1)[/TD]
[/TR]
[TR]
[TD] found_alpha = true[/TD]
[TD]found_alpha = true[/TD]
[/TR]
[TR]
[TD] break[/TD]
[TD]break[/TD]
[/TR]
[TR]
[TD] end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD] end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD] if not found_alpha then[/TD]
[TD]if not found_alpha then[/TD]
[/TR]
[TR]
[TD] modified_key = modified_key:gsub("^.", string.upper, 5)[/TD]
[TD]modified_key = modified_key:gsub("^.", string.upper, 5)[/TD]
[/TR]
[TR]
[TD] end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD] if modified_key:match(".*%*$") and not matchedKeys[modified_key] then[/TD]
[TD]if modified_key:match(".*%*$") and not matchedKeys[modified_key] then[/TD]
[/TR]
[TR]
[TD] for _, val in pairs(args) do[/TD]
[TD] for _, val in pairs(args) do[/TD]
[/TR]
[TR]
[TD]if val == value and val ~= "" then[/TD]
[TD]if val == value and val ~= "" then[/TD]
[/TR]
[TR]
[TD]local alreadyAdded = string.match(output, val:gsub("^%l", string.upper))[/TD]
[TD]local alreadyAdded = string.match(output, val:gsub("^%l", string.upper))[/TD]
[/TR]
[TR]
[TD]if not alreadyAdded then[/TD]
[TD]if not alreadyAdded then[/TD]
[/TR]
[TR]
[TD]local bg_style = 'background-color:' .. (args[key .. "bg"] or "") .. ';'[/TD]
[TD]output = output .. '<tr><th style="' .. (args.style or "") .. '; background:blac;color:whit ;font-size:16px; text-align:center; background-color:; color:' .. (args.cl or "") .. '; font-weight:bold;">' .. val:gsub("^%l", string.upper) .. '</th>\n</tr>\n'[/TD]
[/TR]
[TR]
[TD]output = output .. '<tr><th style="' .. (args.style or "") .. '; color:' .. (args.cl or "") .. '; font-size:16px; text-align:center; ' .. bg_style .. ' font-weight:bold;">' .. val:gsub("^%l", string.upper) .. '</th></tr>\n'[/TD]
[/TR]
[TR]
[TD]matchedKeys[modified_key] = true[/TD]
[TD]matchedKeys[modified_key] = true[/TD]
[/TR]
[TR]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[TD]end[/TD]
[/TR]
[TR]
[TD]end[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]-- Output the result[/TD]
[/TR]
[TR]
[TD]print(output)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]--[[[/TD]
[TD]--[[[/TD]
[/TR]
Okumaya devam et...