Modul:Box-header: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Hidayatsrf (bicara | kontrib) Tidak ada ringkasan suntingan |
Tidak ada ringkasan suntingan |
||
(4 revisi perantara oleh 2 pengguna tidak ditampilkan) | |||
Baris 1:
local getArgs = require('Module:Arguments').getArgs
local p = {}
---------- Config data ----------
Baris 276 ⟶ 278:
local function boxHeaderEditLink(args)
if not page or page == '{{{2}}}'
then
return ''
end
local style = {
color = getParam(args, 'titleforeground') or '#000'
Baris 281 ⟶ 288:
local tag = mw.html.create('span')
:css(style)
:wikitext('
local linktext = tostring(tag)
local linktarget = tostring(mw.uri.fullUrl(
return '[' .. linktarget .. ' ' .. linktext .. '] '
end
Baris 344 ⟶ 351:
:css('border-top-width', ( getParam(args, 'border-top') or '1' ) .. 'px')
:css('padding-top', getParam(args, 'padding-top') or '.3em')
:css('border-radius', getParam(args, 'border-radius') or '0')
return toOpenTagString(tag)
Baris 364 ⟶ 369:
if insufficientTitleContrast and insufficientBodyContrast then
return '[[
elseif insufficientTitleContrast then
return '[[
elseif insufficientBodyContrast then
return '[[
else
return ''
Baris 378 ⟶ 383:
-- Entry point for templates (manually-specified colours)
function p.boxHeader(frame)
local
local
page = mw.title.getCurrentTitle().prefixedText
end
local output = p._boxHeader(
if mw.ustring.find(output, '{') then
return frame:preprocess(output)
Baris 431 ⟶ 435:
-- Entry point for templates (automatically calculated colours)
function p.autoColour(frame)
local
local
▲ local colourParam = getParam(parentArgs, 'colour')
local generatedColour = nil
if not colourParam or colourParam == '' then
-- convert the root page name into a number and use that
local root = mw.title.getCurrentTitle().rootPageTitle.prefixedText
local rootStart = mw.ustring.sub(root, 1, 12)
local digitsFromRootStart = mw.ustring.gsub(rootStart, ".", function(s) return math.fmod(string.byte(s, 2) or string.byte(s, 1), 10) end)
Baris 443 ⟶ 446:
generatedColour = math.fmod(numberFromRoot, 360)
end
local output = p._autoColour(
if mw.ustring.find(output, '{') then
return frame:preprocess(output)
|