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))
k Cleanup
 
(2 revisi perantara oleh 2 pengguna tidak ditampilkan)
Baris 58:
-- maximum of 500,000 possible archives before we hit the
-- expensive function limit.
local function getBiggestArchiveNum( prefix, start, max )
-- Return the value for max if it is specified.
max = processNumArg( max )
Baris 66:
-- Otherwise, detect the largest archive number.
start = start or 1
local check1000 = checkArchives( prefix, 1000, 1start )
if check1000 == 1start then
return 0 -- Return 0 if no archives were found.
end
Baris 90 ⟶ 91:
end
else
ret = ret .. 'ArchiveArsip '
end
return ret
Baris 97 ⟶ 98:
-- 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 ⟶ 115:
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 ⟶ 125:
 
-- 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 = 'Arsip '
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 ⟶ 187:
-- 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 'nobelum archivesada yetarsip ([[' .. glargs.prefix .. '1|createbuat]])'
end
end
-- Return an html error if the start number is greater than the
Baris 173 ⟶ 197:
local start = glargs.start or 1
if start > glargs.max then
return '<span class="error">StartNilai valueawal "'
.. tostring( start )
.. '" islebih greaterbesar thandaripada theangka mostarsip recent archive numberterkini "'
.. tostring( glargs.max )
.. '".</span>'
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 ⟶ 239:
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 maxlineNum = getBiggestArchiveNumgetLineNum( prefixargs.links, args.maxnobr, isLong )
local lineNumlinkPrefix = getLineNumgetLinkPrefix( args.linkslinkprefix, args.nobrlinkprefixspace, isLong )
local linkPrefix = getLinkPrefix( args.linkprefix, args.linkprefixspace )
local start = getStart( args.start )
local max = getBiggestArchiveNum( prefix, start, args.max )
local sep = getSeparator( args.sep )
local lineSep = getSeparator( args.linesep )
Baris 222 ⟶ 272:
prefix = prefix,
linkPrefix = linkPrefix,
isLong = isLong,
sep = sep,
lineNum = lineNum,