Module:Ref: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 65: Line 65:
local text = "''" .. tostring( content[ 1 ] or '' ) .. "''"
local text = "''" .. tostring( content[ 1 ] or '' ) .. "''"
if not utils.empty( content.section ) then
if not utils.empty( content.section ) then
text = text .. ' - ' .. tostring( content.section )
text = text .. ': ' .. tostring( content.subheading )
end
end
content[ 1 ] = ''
content[ 1 ] = ''
Line 174: Line 174:


--[[[
--[[[
Invocation entry point for Template:Ref/Generic. Currently unimplemented.
Invocation entry point for Template:Ref/Generic.


@param frame - object - The current parser frame
@param frame - object - The current parser frame
Line 186: Line 186:
[ 'valid' ] = { 'id', 'subheading', 3, 4, 5, 6, 7, 'detail', 'quote',
[ 'valid' ] = { 'id', 'subheading', 3, 4, 5, 6, 7, 'detail', 'quote',
'quotee', 'quoteelinktext', 'suffix' },
'quotee', 'quoteelinktext', 'suffix' },
[ 'aliases' ] = { [ 1 ] = 'heading', [ 'section' ] = 'subheading' }
[ 'aliases' ] = { [ 1 ] = 'heading', [ 'section' ] = 'subheading' },
[ 'invalid' ] = { 'section' }
})
})
local content = {
local content = {
args.heading, args[2], args[3], args[4], args[5], args[6], args[7],
args.heading, args[2], args[3], args[4], args[5], args[6], args[7],
[ 'section' ] = args.subheading,
[ 'subheading' ] = args.subheading,
[ 'detail' ] = args.detail,
[ 'quote' ] = args.quote,
[ 'quotee' ] = args.quotee,
[ 'suffix' ] = args.suffix
}
return out .. makeStandardRef( frame, args.id, nil, content)
end
 
--[[[
Invocation entry point for Template:Ref/Game.
 
@param frame - object - The current parser frame
 
@return wikitext - the constructed reference
]]
function ref.game( frame )
local args, out = arguments.preprocess( frame, {
[ 'required' ] = { 'game' },
[ 'recommended' ] = { 'what' },
[ 'valid' ] = { 'id', 'part', 'detail', 'quote',
'quotee', 'quoteelinktext', 'suffix' },
[ 'aliases' ] = { [ 1 ] = 'game', [ 2 ] = 'what', [ 'expansion' ] = 'part', [ 'dlc' ] = 'part' },
[ 'invalid' ] = { 'section' }
})
local content = {
args.game, args.what,
[ 'subheading' ] = args.part,
[ 'detail' ] = args.detail,
[ 'detail' ] = args.detail,
[ 'quote' ] = args.quote,
[ 'quote' ] = args.quote,