Jump to content

Module:User:Vuh/Sandbox

From Wikipedia, the free encyclopedia
local p={}
local getArgs = require('Module:Arguments').getArgs
 
p[""] = function(frame)
 
    args = frame and frame.args or {}
    myspecial = args.special or ''
    page = mw.title.new('Help:Special page')
    page = page:getContent()
    nextvariety = mw.ustring.gmatch(page, '%[%[Special:(.-)%]%]')
    repeat
        variety = nextvariety()
    until (not variety or not args.startat or mw.ustring.match(variety, args.startat))
    good = {}
    nogood = {}
    while variety and (not variety.endat or (not mw.ustring.match(variety, args.endat))) do
        local gett = mw.text.unstrip(frame:preprocess('{{Special:' .. variety .. '}}'))
        if mw.ustring.sub(gett, 1, 2) == "[[" then
            table.insert(nogood, gett .. ", ")
        else
        	table.insert(good, "\n*" .. variety .. ":  " .. mw.ustring.sub((mw.ustring.gsub(gett, '<', '&lt;')), 1, 200))
        end
        variety = nextvariety()
    end
    return table.concat(nogood) .. "\n\n" .. table.concat(good)
end
 
return p