local getArgs = require('Module:Arguments').getArgslocal p =
-- Fetch expansions of Editing advice meta templateslocal function getRequestedAdvice(haystack, needle, pages) -- if a request is made for that advice if string.match(haystack, needle) then return mw.getCurrentFrame:expandTemplate end return end
-- Return concatenation of fetched template expansionslocal function compileRequestedAdvice(about, pages) return getRequestedAdvice(about, 'preview', pages) .. getRequestedAdvice(about, 'summary') .. getRequestedAdvice(about, 'sandbox')end
--function p._getAdvice(cleanargs) -- Create capturing vars for data local about = local pages = local section = local f = mw.getCurrentFrame -- Iterate through provided params for key, value in pairs(cleanargs) do -- If the param specifies the advice requested if key
'section' then -- store the value section[1] = value else --If neither of the above, these params must be pages so store the values as they are processed pages[#pages + 1] = value end end -- Output concatenation of fetched strings return f:expandTemplate .. compileRequestedAdvice(about, pages) .. f:expandTemplateend
--Get and cleanup frame args and pass them to _getAdvicefunction p.getAdvice(frame) local args = getArgs(frame) return p._getAdvice(args)end
return p