మాడ్యూల్:Details: కూర్పుల మధ్య తేడాలు

వికీపీడియా నుండి
Jump to navigation Jump to search
Content deleted Content added
Moved tracking apparatus so that only pages using the old parameterization are categorized
Updated from sandbox. Adds support for an indefinite number of pages, removes tracking apparatus used for reparameterization
పంక్తి 5: పంక్తి 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 page = args[1]
local topic, category = args.topic, args.category
local options = {selfref = args.selfref}
local topic = args.topic or (args[2] and args[2] .. '[[Category:Pages using details hatnote with topic specified]]')
args = mTableTools.compressSparseArray(args)
if not page then
if #args == 0 then
return mHatnote.makeWikitextError(
return mHatnote.makeWikitextError(
'no page name specified',
'no page name specified',
'Template:Details#Errors',
'Template:Details#Errors',
args.category
category
)
)
end
end
return p._details(args, topic, options)
local options = {
selfref = args.selfref,
}
return p._details(page, topic, options)
end
end


function p._details(page, topic, options)
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, page)
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

18:58, 14 జూన్ 2016 నాటి కూర్పు

--[[
-- 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