Module:Luadocs/sandbox

-- Shows modules links in the list of global modules -- Syntax :

local p = {} local getArgs = require("Dev:Arguments").getArgs local isMod = require("Dev:Existsmod").module_exists

function p.create_links(modName, wikipedia, noTests,extDoc) local headerText = modName local modLinks = { "Docs", "Source" }   if wikipedia then local icon = ""

headerText = icon .. " " .. modName .. " " .. icon end

local headerDiv = mw.html.create("div") :css("font-size", "18px") :css("line-height", "26px") :wikitext(headerText)

if not noTests then local testPage = "Module:" .. modName .. "/testcases" local testLink = "Tests"

if not isMod(testPage, true) then local url = mw.uri.fullUrl(testPage):extend{ action = "edit", preload = "Template:Moduletestcases" }

testLink = testLink .. "([" .. tostring(url) .. " add])" end

modLinks[3] = testLink end

return tostring(headerDiv) .. table.concat(modLinks, " · ") end

function p.main(frame) local args = getArgs(frame)

if args[1] then return p.create_links(args[1], args["wikipedia"], args["notests"],args["extdoc"]) end end

return p