Module:Sandbox/Aseleste/Indexer: Difference between revisions

Content deleted Content added
test: debug
Reverted to revision 1001388836 by Aseleste (talk): Remove: debug code
Line 13:
local escape_replacement;
local unstrip_and_strip_nowiki_tags;
 
local d = {}
 
-- exposed: categorizes content and display them
Line 21 ⟶ 19:
local args = build_args(frame)
local folder = as_fold_function(mw.text.trim(unstrip_and_strip_nowiki_tags(args.folder)))
local keys = build_keys(args)
local values = build_values(mw.text.trim(unstrip_and_strip_nowiki_tags(args.content)))
local result = ""
Line 40 ⟶ 38:
end
return mw.text.nowiki(mw.dumpObject({args = args, keys = keys, values = values, result = result, d = d}))
end
 
Line 67 ⟶ 65:
if arg_k_trim:match("^table_") then
local key = arg_k_trim:gsub("table_", "", 1)
result[key] = as_key_content_function(mw.text.trim(unstrip_and_strip_nowiki_tags(arg_v)))
end
end
Line 128 ⟶ 126:
as_key_content_function = function(text)
local function func(content)
table.insert(d, {concatype = 'key', text = text, content = content, result = text:gsub("__M_CONTENT__", escape_replacement(content))})
return text:gsub("__M_CONTENT__", escape_replacement(content))
end
Line 138 ⟶ 135:
as_value_content_function = function(text)
local function func(category)
table.insert(d, {concatype = 'value', text = text, category = category, result = text:gsub("__M_CATEGORY__", escape_replacement(category))})
return text:gsub("__M_CATEGORY__", escape_replacement(category))
end
Line 149 ⟶ 145:
local function func(left, right)
-- some improvements could be made here
table.insert(d, {concatype = 'fold', text = text, left = left, right = right, result = text:gsub("__M_LEFT__", escape_replacement(left)):gsub("__M_RIGHT__", escape_replacement(right))})
return text:gsub("__M_LEFT__", escape_replacement(left)):gsub("__M_RIGHT__", escape_replacement(right))
end