Module:Details: Difference between revisions
Content added Content deleted
m (1 revision imported: Templates) |
m (1 revision imported: categories) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
local mHatnote = require('Module:Hatnote') |
local mHatnote = require('Module:Hatnote') |
||
local mHatlist = require('Module:Hatnote list') |
|||
local mArguments -- lazily initialise |
local mArguments -- lazily initialise |
||
local mTableTools -- lazily initialise |
|||
local p = {} |
local p = {} |
||
function p.details(frame) |
function p.details (frame) |
||
mArguments = require('Module:Arguments') |
mArguments = require('Module:Arguments') |
||
mTableTools = require('Module:TableTools') |
|||
local args = mArguments.getArgs(frame, {parentOnly = true}) |
local args = mArguments.getArgs(frame, {parentOnly = true}) |
||
local |
local topic, category = args.topic, args.category |
||
local |
local options = {selfref = args.selfref} |
||
args = mTableTools.compressSparseArray(args) |
|||
if |
if #args == 0 then |
||
return mHatnote.makeWikitextError( |
return mHatnote.makeWikitextError( |
||
'no page name specified', |
'no page name specified', |
||
'Template:Details#Errors', |
'Template:Details#Errors', |
||
category |
|||
) |
) |
||
end |
end |
||
⚫ | |||
local options = { |
|||
selfref = args.selfref, |
|||
} |
|||
⚫ | |||
end |
end |
||
function p._details( |
function p._details (list, topic, options) |
||
list = mHatlist.andList(list, true) |
|||
page = mHatnote._formatLink(page) |
|||
topic = topic or 'this topic' |
topic = topic or 'this topic' |
||
local text = string.format('For more details on %s, see %s.', topic, |
local text = string.format('For more details on %s, see %s.', topic, list) |
||
options = options or {} |
|||
return mHatnote._hatnote(text, options) |
return mHatnote._hatnote(text, options) |
||
end |
end |
Latest revision as of 18:47, 22 June 2016
Documentation for this module may be created at Module:Details/doc
--[[
-- This module produces a "For more details on this topic" link. It implements
-- the {{details}} template.
--]]
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments -- lazily initialise
local mTableTools -- lazily initialise
local p = {}
function p.details (frame)
mArguments = require('Module:Arguments')
mTableTools = require('Module:TableTools')
local args = mArguments.getArgs(frame, {parentOnly = true})
local topic, category = args.topic, args.category
local options = {selfref = args.selfref}
args = mTableTools.compressSparseArray(args)
if #args == 0 then
return mHatnote.makeWikitextError(
'no page name specified',
'Template:Details#Errors',
category
)
end
return p._details(args, topic, options)
end
function p._details (list, topic, options)
list = mHatlist.andList(list, true)
topic = topic or 'this topic'
local text = string.format('For more details on %s, see %s.', topic, list)
return mHatnote._hatnote(text, options)
end
return p