Module:Citation: Difference between revisions

From ProleWiki, the proletarian encyclopedia
mNo edit summary
mNo edit summary
Line 10: Line 10:
v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1'); -- trim leading/trailing whitespace; when v is only whitespace, becomes empty string
v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1'); -- trim leading/trailing whitespace; when v is only whitespace, becomes empty string
args[k] = v;
args[k] = v;
return table.concat ({
frame:extensionTag ('templatestyles', '', {src=styles}),
citation0( config, args)
});
end
end
local Author = frame.args['author'];
return Author
end
end

Revision as of 01:25, 26 October 2021

local function citation(frame)								-- creates citation function
	local pframe = frame:getParent()						-- creating a way to access parameters from a template
	local styles;
	local args = {};										-- creating a table to store all arguments from the template
	local config = {};										-- creating a table to store parameters from the module {{#invoke:}}
	for k, v in pairs( frame.args ) do						-- getting parameters from the module frame
		config[k] = v;
	end
	for k, v in pairs( pframe.args ) do						-- processing every key-value pair from the template arguments
		v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1');		-- trim leading/trailing whitespace; when v is only whitespace, becomes empty string
		args[k] = v;
	end
	local Author = frame.args['author'];
	return Author
end