Module:Infobox: Difference between revisions

m Protected "Module:Infobox": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
Add 0th section edit link
Line 2: Line 2:
function p.infobox( f )
function p.infobox( f )
local args = require( 'Module:ProcessArgs' ).merge( true )
local args = require( 'Module:ProcessArgs' ).merge( true )
local title = args.title or mw.title.getCurrentTitle().baseText
local titleObject = mw.title.getCurrentTitle()
local title = args.title or titleObject.baseText
local imageArea = args.imagearea
local imageArea = args.imagearea
Line 40: Line 41:
if imageTitle and imageTitle.exists then
if imageTitle and imageTitle.exists then
image = '[[File:' .. title .. '.png|' .. size .. ']]'
image = '[[File:' .. title .. '.png|' .. size .. ']]'
elseif mw.title.getCurrentTitle().namespace == 0 then
elseif titleObject.namespace == 0 then
image = '[[File:No image.svg|' .. size .. '|link=File:' .. title .. '.png|Upload ' .. title .. '.png]]'
image = '[[File:No image.svg|' .. size .. '|link=File:' .. title .. '.png|Upload ' .. title .. '.png]]'
else
else
Line 108: Line 109:
local html = {
local html = {
'<div class="notaninfobox">',
'<div class="notaninfobox">',
'<div class="infobox-title mcwiki-header">' .. title .. '</div>',
'<div class="infobox-title mcwiki-header"><span class="editsection">[[' ..
tostring( mw.uri.fullUrl( titleObject.fullText, { action = 'edit', section = 0 } ) ) .. ' edit' ..
']]</span>' .. title .. '</div>',
imageArea,
imageArea,
'{| class="infobox-rows" cellspacing="1" cellpadding="4"',
'{| class="infobox-rows" cellspacing="1" cellpadding="4"',