| 👁 Warning | This Lua module is used on approximately 91,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
| 👁 Image | This module depends on the following other modules: |
Usage
Used by Template:see also if exists and Template:Category see also if exists.
{{#invoke:See also if exists| main}}
--[[ v1.0 ]] localp={} localyesno=require("Module:yesno") localfunctionexists(title) localsuccess,result=pcall(function()returntitle.existsend) ifsuccessthen returnresult else returntrue end end functionp.main(frame) localrawpages={} localnvalid=0 localnamespace=frame.args.ns fori,vinipairs(frame:getParent().args)do if(v~=nil)then localthisArg=mw.text.trim(v) if(thisArg~="")then localtitle=mw.title.new(thisArg,namespace) iftitle~=nilandexists(title)then table.insert(rawpages,title.fullText) nvalid=nvalid+1 end end end end if(nvalid==0)then ifyesno(frame.args.warning)then ifnamespace==nilthen namespace="page" elseifnamespace:sub(-1)=="y"then namespace=namespace:sub(0,-2).."ie" end mw.addWarning(string.format("'''[[%s]] — no output, because none of the %ss currently exist.'''", frame:getParent():getTitle(),namespace)) end return"" end localmLabelledList=require('Module:Labelled list hatnote') localpages=mLabelledList._labelledList(rawpages,"See also","") returnpages end returnp
Hidden category:
