Jump to content
Wikipedia The Free Encyclopedia

Module:Anchor

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
[画像:Warning] This Lua module is used in system messages, and on approximately 92,000 pages.
Changes to it can cause immediate changes to the Wikipedia user interface.
To avoid major disruption, 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. Please discuss 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.
Page template-protected This module is currently protected from editing.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
This module depends on the following other modules:

This module implements {{anchor }}. Please see the Template:Anchor/doc page for documentation.

The above documentation is transcluded from Module:Anchor/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Subpages of this module.

 -- This module implements {{anchor}}.

 localgetArgs=require('Module:Arguments').getArgs
 localtableTools=require('Module:TableTools')

 localp={}

 functionp.main(frame)
 -- Get the positional arguments from #invoke, remove any nil values,
 -- and pass them to p._main.
 localargs=getArgs(frame)
 localargArray=tableTools.compressSparseArray(args)
 returnp._main(unpack(argArray))
 end

 functionp._main(...)
 -- Generate the list of anchors.
 localanchors={...}
 localret={}
 for_,anchorinipairs(anchors)do
 ret[#ret+1]='<span class="anchor" id="'..anchor..'"></span>'
 end
 returntable.concat(ret)
 end

 returnp

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