Module:Wp/lki/Further
This module produces a "Further information: a, b and c" link. It implements the {{further}} template.
Usage from wikitext
[edit source]This module cannot be used directly from #invoke. Instead, it can only be used through the {{further}} template. Please see the template page for documentation.
Usage from other Lua modules
[edit source]Load the module:
local mFurther = require('Module:wp/lki/Further')
You can then use the _further function like this:
mDetails._further(options, ...)
The parameters following options are the page names that appear after the "Further information:" text. Page names can include a section link if desired. Pages with section links are automatically formatted as page § section, rather than the MediaWiki default of page#section.
The options variable is an optional configuration table. At current, the only option available is "selfref", which is used when the output is a self-reference to Wikipedia. to set this option, use Template:Wp/lki/Code. (See the {{selfref}} template for more details on self-references.)
- Example 1
mFurther._further(nil, 'A')
Produces:
<div class="hatnote">Further information: [[A]]</div>
Displays as: Script error: No such module "wp/lki/further".
- Example 2
mFurther._further(nil, 'A', 'B', 'C')
Produces:
<div class="hatnote">Further information: [[A]], [[B]] and [[C]]</div>
Displays as: Script error: No such module "wp/lki/further".
- Example 3
mFurther._further({selfref = true}, 'A#D', 'B#D', 'C#D')
Produces:
<div class="hatnote selfref">Further information: [[A#D|A § D]], [[B#D|B § D]] and [[B#D|C § D]]</div>
Displays as: Script error: No such module "wp/lki/further".
Technical details
[edit source]This module uses Module:Wp/lki/Hatnote to format the hatnote text, Module:Wp/lki/TableTools to process the list of links, and Module:Wp/lki/Arguments to fetch the arguments from wikitext.
--[[
-- This module produces a "Further information: a, b and c" link. It implements
-- the {{Wp/lki/Further}} template.
--]]
local mHatnote = require('Module:Wp/lki/Hatnote')
local mHatlist = require('Module:Wp/lki/Hatnote list')
local mTableTools -- lazily initialise
local mArguments -- lazily initialise
local p = {}
function p.further(frame)
mTableTools = require('Module:Wp/lki/TableTools')
mArguments = require('Module:Wp/lki/Arguments')
local args = mArguments.getArgs(frame, {parentOnly = true})
local pages = mTableTools.compressSparseArray(args)
if #pages < 1 then
return mHatnote.makeWikitextError(
'no page names specified',
'Template:Wp/lki/Further#Errors',
args.category
)
end
local options = {
selfref = args.selfref
}
return p._further(pages, options)
end
function p._further(pages, options)
local text = 'اطلاعات بیشتر: ' .. mHatlist.andList(pages, true)
return mHatnote._hatnote(text, options)
end
return p