Idi na sadržaj

Modul:Other uses

S Wikipedije, slobodne enciklopedije

Dokumentaciju za ovaj modul možete napraviti na straniciModul:Other uses/dok

localmHatnote=require('Modul:Hatnote')
localmHatlist=require('Modul:Hatnote list')
localmArguments--initialize lazily
localmTableTools--initialize lazily
locallibraryUtil=require('libraryUtil')
localcheckType=libraryUtil.checkType
localp={}

-- Produces standard {{other uses}} implementation
functionp.otheruses(frame)
mArguments=require('Modul:Arguments')
mTableTools=require('Modul:TableTools')
localargs=mTableTools.compressSparseArray(mArguments.getArgs(frame))
localtitle=mw.title.getCurrentTitle().text
returnp._otheruses(args,{title=title})
end

-- Main generator
functionp._otheruses(args,options)
--Type-checks and defaults
checkType('_otheruses',1,args,'table',true)
args=argsor{}
checkType('_otheruses',2,options,'table')
ifnot(options.defaultPageoroptions.title)then
error('No default title data provided in "_otheruses" options table',2)
end
localemptyArgs=true
fork,vinpairs(args)do
iftype(k)=='number'thenemptyArgs=falsebreakend
end
ifemptyArgsthen
args={
options.defaultPageor
mHatnote.disambiguate(options.title,options.disambiguator)
}
end
--Generate and return hatnote
localtext=mHatlist.forSeeTableToString({{
use=options.otherTextand"druga"..options.otherTextornil,
pages=args
}})
returnmHatnote._hatnote(text)
end

returnp