మాడ్యూల్:Details: కూర్పుల మధ్య తేడాలు
Jump to navigation
Jump to search
Content deleted Content added
Added tracking category for use of second parameter per talk |
Added support for named "topic" parameter instead of second positional parameter |
||
పంక్తి 13: | పంక్తి 13: | ||
local args = mArguments.getArgs(frame, {parentOnly = true}) |
local args = mArguments.getArgs(frame, {parentOnly = true}) |
||
local page = args[1] |
local page = args[1] |
||
local topic = args[2] |
local topic = args.topic or args[2] |
||
if not page then |
if not page then |
||
return mHatnote.makeWikitextError( |
return mHatnote.makeWikitextError( |
14:43, 14 జూన్ 2016 నాటి కూర్పు
--[[
-- This module produces a "For more details on this topic" link. It implements
-- the {{details}} template.
--]]
local mHatnote = require('Module:Hatnote')
local mArguments -- lazily initialise
local p = {}
function p.details(frame)
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame, {parentOnly = true})
local page = args[1]
local topic = args.topic or args[2]
if not page then
return mHatnote.makeWikitextError(
'no page name specified',
'Template:Details#Errors',
args.category
)
end
local options = {
selfref = args.selfref,
}
return p._details(page, topic, options)
end
function p._details(page, topic, options)
page = mHatnote._formatLink(page)
topic = (topic and topic .. '[[Category:Pages using details hatnote with topic specified]]') or 'this topic'
local text = string.format('For more details on %s, see %s.', topic, page)
options = options or {}
return mHatnote._hatnote(text, options)
end
return p