Module:About/sandbox
Appearance
From Wikipedia, the free encyclopedia
This is the module sandbox page for Module:About (diff).
See also the companion subpage for test cases (run).
See also the companion subpage for test cases (run).
Warning This Lua module is used on 167,000+ pages .
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
This module depends on the following other modules:
This module implements the {{about }} hatnote template.
Usage
[edit ]- The
aboutfunction implements the {{about }} template directly, using the frame and applying no options. This should probably only be used in {{about }}.
- The
_aboutfunction can be used from Lua to supply a custom arguments list (its first argument) and/or an options table (its second argument). Options include:aboutFormA string that can be used to substitute the form of the initial "about" message. It should include two substitution points: the first for the page type (e.g. "article"), and the second for the description of what the page is about. It should also include a trailing space for easy concatenation or omission. Defaults to'This %s is about %s. '.sectionStringGives the page type string for when the named argumentsectionis specified. Defaults to'section'.
The above documentation is transcluded from Module:About/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Add categories to the /doc subpage. Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Add categories to the /doc subpage. Subpages of this module.
localmArguments--initialize lazily localmHatnote=require('Module:Hatnote') localmHatList=require('Module:Hatnote list') locallibraryUtil=require('libraryUtil') localcheckType=libraryUtil.checkType localp={} functionp.about(frame) -- A passthrough that gets args from the frame and all mArguments=require('Module:Arguments') args=mArguments.getArgs(frame) returnp._about(args) end functionp._about(args,options) -- Produces "about" hatnote. -- Type checks and defaults checkType('_about',1,args,'table',true) args=argsor{} checkType('_about',2,options,'table',true) options=optionsor{} localdefaultOptions={ aboutForm='This %s is about %s. ', PageType=require('Module:Pagetype').main(), otherText=nil,--included for complete list sectionString='section' } fork,vinpairs(defaultOptions)do ifoptions[k]==nilthenoptions[k]=vend end -- Set initial "about" string localpageType=(args.sectionandoptions.sectionString)oroptions.PageType localabout='' ifargs[1]then about=string.format(options.aboutForm,pageType,args[1]) end --Allow passing through certain options localfsOptions={ otherText=options.otherText, extratext=args.text } localhnOptions={ selfref=args.selfref } -- Set for-see list localforSee=mHatList._forSee(args,2,fsOptions) -- Concatenate and return returnmHatnote._hatnote(about..forSee,hnOptions) end returnp