![]() |
VOOZH | about |
This module implements {{Shortcut}}. See that template's documentation for more information.
Dependencies:
localp={} localget_args=require("Module:Arguments").getArgs localfunctiontransclude(title_str) localtitle=mw.title.new(title_str) iftitle:inNamespace(0)then iftitle.namespace==mw.title.new("Template"..title_str).namespacethen return"Template:"..title_str else returntitle.text end end returntitle.fullText end functionp.main(frame) localargs=get_args(frame) localalign=args["align"]or"right" localmargin=args["margin"]or"0 0 1em 1em" localredirect=args["redirect"]~=nil localcount=0 fori,vinipairs(args)do count=count+1 end ifcount<1then error("At least one shortcut must be provided") end localtext="<div class=\"toccolours shortcut-box\" style=\"clear: "..align.."; float: "..align.."; margin: "..margin..";\">" .."<div class=\"shortcut-box-title\">"..(redirectand"Redirect"or"Shortcut")..(count==1and''or's').."</div>" fori=1,count,1do localurl=tostring(mw.uri.fullUrl(transclude(args[i]),"redirect=no")) text=text.."<div class=\"shortcut-box-row\">["..url..' '..args[i].."]</div>" end text=text.."</div>" returntext end returnp