Module:Get short description/sandbox explained

require ('strict')

--

local patterns_t =

-------------------------------< G E T C O N T E N T >-------------------------------------------------------

fetch the article's raw wikitext

local function getContent(title) local success, titleObj = pcall(mw.title.new, title) -- get a title object for title if not success then return nil end -- return nil if sommat went wron return titleObj:getContent -- return wikitext elseend

-------------------------------< M A I N >-------------------------------------------------------------------

local function main(frame, title) -- do we really need here? local title = frame.args[1] local wikitext = getContent(title) if wikitext</p> <h2>nil then return "" end -- sommat went wrong, abandon</h2> <p>for _, pattern in ipairs (patterns_t) do -- for each pattern in the sequence of redirect patterns local description = wikitext:match ('</p><div class="Footer"> <div class="robots-noindex"><p>This article is licensed under the <a href="http://www.gnu.org/copyleft/fdl.html" rel="nofollow">GNU Free Documentation License</a>. It uses material from the Wikipedia article "<a href="http://en.wikipedia.org/wiki/Module%3aGet_short_description%2fsandbox" rel="nofollow">Module:Get short description/sandbox</a>".</p></div> <p>Except where otherwise indicated, Everything.Explained.Today is © Copyright 2009-2024, A B Cryer, All Rights Reserved. <a href="http://explained.today/cookie_policy.htm">Cookie policy</a>.</p> </div> </div> </body> </html>