Jump to content

Module:Template wrapper

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Trappist the monk (talk | contribs) at 21:42, 26 December 2017 (Created page with 'require('Module:No globals'); p={} function p.cs1_wrapper (frame) local args = {}; local template; for k, v in pairs (frame.args) do if 'template' == k...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

require('Module:No globals');

p={}

function p.cs1_wrapper (frame)
	local args = {};
	local template;
	
	for k, v in pairs (frame.args) do
		if 'template' == k then
			template = v;														-- save the name of template that we are wrapping
		else
			args[k] = v;														-- copy frame parameters to args table
		end
	end

	local pframe = frame:getParent();
	for k, v in pairs (pframe) do
		args[k] = v;															-- copy parent frame parameters to args table
	end
	
	return frame:expandTemplate ({title=template, args=args});					-- render the citation
end

return p;