Jump to content
Wikipedia The Free Encyclopedia

Module:Main if exists

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
This module depends on the following other modules:

Usage

Used by Template:Main if exists

{{#invoke:Main if exists| main}}

The above documentation is transcluded from Module:Main if exists/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.

 --[[ v1.0
 ]]
 localp={}
 localyesno=require("Module:yesno")

 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~=nilandtitle.existsthen
 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,"Main","")
 returnpages
 end

 returnp

AltStyle によって変換されたページ (->オリジナル) /