Documentation[créer] [purger]
-- This Module:RefDetail can extend any re-use of a ref like <ref name="refname"/>
-- with some detail in the same style.
-- It is used by Modèle:RefDetail for easier writing.
-- example : initial ref <ref name="ABC">referal book</ref>
-- and anywhere in the same page {{RefDetail|ABC|p.123}}
-- direct module use {{#invoke:RefDetail|ref|ABC|p.123}}

local p = {}

function p.ref(frame)
	local args_invoke = frame.args
	local args_template = frame:getParent().args
	local refname = ""
	if args_invoke and args_invoke[1] then refname = args_invoke[1] or refname end
	if args_template and args_template[1] then refname = args_template[1] or refname end
	local detail = ""
	if args_invoke and args_invoke[2] then detail = args_invoke[2] or detail end
	if args_template and args_template[2] then detail = args_template[2] or detail end
	local reftxt = frame:preprocess('<ref name="' .. refname .. '" />')
	local detailtxt = '<sup><span style="color:#0645ad;">' .. detail .. '</span></sup>'
	return reftxt .. detailtxt
end

return p