Modul:Archive list: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Farras (bicara | kontrib)
k Mengubah tingkat pelindungan "Modul:Archive list": Templat berisiko tinggi ([Sunting=Hanya untuk pengurus] (selamanya) [Pindahkan=Hanya untuk pengurus] (selamanya))
Update
Baris 97:
-- Get the number of archives to put on one line. Set to
-- math.huge if there should be no line breaks.
local function getLineNum( links, nobr, isLong )
local linksToNum = tonumber( links )
local lineNum
Baris 114:
end
else
if isLong==true then
lineNum = 10 -- Default to 10 links.
lineNum = 3 -- Default to 3 links on long
else
lineNum = 10 -- Default to 10 links.on short
end
end
return lineNum
Baris 120 ⟶ 124:
 
-- Gets the prefix to put before the archive links.
local function getLinkPrefix( prefix, space, isLong )
-- Get the link prefix.
local ret = ''
if isLong==true then ---- Default of old template for long is 'Archive '
if type(prefix) == 'string' then
ret = prefix
if spaceprefix == 'yesnone' then -- 'none' overrides to empty prefix
ret = ret .. ' '
endelse
ret = prefix
if space == 'yes' then
ret = ret .. ' '
end
end
else
ret = 'Archive '
end
else --type is not long
if type(prefix) == 'string' then
ret = prefix
if space == 'yes' then
ret = ret .. ' '
end
end
end
return ret
Baris 167 ⟶ 186:
-- link to create Archive one.
if glargs.max == 0 then
if glargs.isLong == true then
return 'no archives yet ([[' .. glargs.prefix .. '1|create]])'
glargs.max = 1 -- One archive redlink is displayed for Long format
else -- Short error and a creat link is displayed for short
return 'no archives yet ([[' .. glargs.prefix .. '1|create]])'
end
end
-- Return an html error if the start number is greater than the
Baris 180 ⟶ 203:
end
local linkPrefix = glargs.linkPrefix or ''
local seplineNum = glargs.seplineNum or mw.message.new( 'comma-separator' ):plain()10
local sep = '' -- Long default separator is cell elements, short is ', '
local lineNum = glargs.lineNum or 10
local lineSep = glargs.lineSep'' or-- '<brLong />default linebreak is row elements short is '\n'
if glargs.isLong==true then
 
local lineNum sep = glargs.lineNumsep or 10''
sep = sep .. '</td><td>'
lineSep = glargs.lineSep or ''
lineSep = lineSep .. '</td></tr><tr><td>'
else
sep = glargs.sep or mw.message.new( 'comma-separator' ):plain()
lineSep = glargs.lineSep or '<br />'
end
-- Generate the archive links.
local lineCounter = 1 -- The counter to see whether we need a line break or not.
local ret = {} -- A table containing the strings to be returned.
if glargs.isLong == true then --Long version is a table
table.insert(ret, "<table style=\"width: 100%; padding: 0px; text-align: center; background-color: transparent;\"><tr><td>")
end
for archiveNum = start, glargs.max do
local link = mw.ustring.format(
Baris 204 ⟶ 238:
lineCounter = 1
end
end
if glargs.isLong == true then --Long version is a table
table.insert(ret, "</td></tr></table>")
end
return table.concat( ret )
end
 
-- Determine if format should be long
local function findFormType( auto )
if auto == nil or auto == '' then
return false
elseif auto == 'long' then
return true
else
return false
end
end
 
-- Get the archive data and pass it to generateLinks().
local function _main( args )
local isLong = findFormType( args.auto )
local prefix = getPrefix( args.root, args.prefix, args.prefixspace )
local max = getBiggestArchiveNum( prefix, args.max )
local lineNum = getLineNum( args.links, args.nobr, isLong )
local linkPrefix = getLinkPrefix( args.linkprefix, args.linkprefixspace, isLong )
local start = getStart( args.start )
local sep = getSeparator( args.sep )
Baris 222 ⟶ 271:
prefix = prefix,
linkPrefix = linkPrefix,
isLong = isLong,
sep = sep,
lineNum = lineNum,