Module:Sandbox/Aseleste/Indexer: Difference between revisions

Content deleted Content added
fix: errors (how did we do that)
fix: broken replacement - attempt 2
Line 12:
local as_fold_function;
local escape_replacement;
local adapt_magic_word_patterndecode_magic_text;
 
-- exposed: categorizes content and display them
Line 126:
as_key_content_function = function(text)
local function func(content)
return decode_magic_text(text):gsub(adapt_magic_word_pattern("__M_CONTENT__"), escape_replacement(content))
end
return func
Line 135:
as_value_content_function = function(text)
local function func(category)
return decode_magic_text(text):gsub(adapt_magic_word_pattern("__M_CATEGORY__"), escape_replacement(category))
end
return func
Line 145:
local function func(left, right)
-- some improvements could be made here
return decode_magic_text(text):gsub(adapt_magic_word_pattern("__M_LEFT__"), escape_replacement(left)):gsub(adapt_magic_word_pattern("__M_RIGHT__"), escape_replacement(right))
end
return func
Line 155:
end
 
-- decode text with magic words
-- adapt magic word pattern for un-escaped and escaped underscore
adapt_magic_word_patterndecode_magic_text = function(text)
-- experimental
return mw.text:gsub.decode("_"text, "[_(&#95)];")
end