Module:Broader
Appearance
From Wikipedia, the free encyclopedia
Warning This Lua module is used on approximately 860 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.
Implements {{broader }}.
The above documentation is transcluded from Module:Broader/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
--[[ -- This module produces a "For a broader coverage related to this topic" link. It implements -- the {{broader}} template. --]] localmHatlist=require('Module:Hatnote list') localmHatnote=require('Module:Hatnote') localmArguments-- lazily initialize localmTableTools--lazily initialize localp={} locals={--localizable strings broaderForm='For broader coverage of %s, see %s.', defaultTopic='this topic' } functionp.broader(frame) mArguments=require('Module:Arguments') mTableTools=require('Module:TableTools') localoriginalArgs=mArguments.getArgs(frame,{parentOnly=true}) localargs=mTableTools.compressSparseArray(originalArgs) -- re-add non-numeric arguments omitted by compressSparseArray for_,nameinpairs({'category','selfref','topic'})do args[name]=originalArgs[name] end returnp._broader(args) end functionp._broader(args) ifnotargs[1]then returnmHatnote.makeWikitextError( 'no page name specified', 'Template:Broader#Errors', args.category ) end locallist=mHatlist.andList(args,true) localtopic=args.topicors.defaultTopic localtext=string.format(s.broaderForm,topic,list) options={selfref=args.selfref} returnmHatnote._hatnote(text,options) end returnp