Wikibuku
minwikibooks
https://min.wikibooks.org/wiki/Palanta
MediaWiki 1.47.0-wmf.19
first-letter
Media
Istimewa
Rundiang
Pangguno
Rundiang Pangguno
Wikibuku
Rundiang Wikibuku
Berkas
Rundiang Berkas
MediaWiki
Rundiang MediaWiki
Templat
Rundiang Templat
Bantuan
Rundiang Bantuan
Kategori
Rundiang Kategori
TimedText
TimedText talk
Modul
Rundiang Modul
Acara
Pembicaraan Acara
Templat:Wikilatih
10
2531
10359
2026-09-15T01:53:03Z
Zhilal Darma
23
←Mambuek laman baisi "<div style="float: right">{{userbox|white|lightgray|[[File:{{{logo|Wikimedia-logo-id.svg}}}|45px|link=]]|Pangguno iko ikuik sato dalam '''[[:wmid:WikiLatih|#WikiLatih]]''' {{{proyek|manyuntiang Wikikato }}} {{#if:{{{acara|}}}| untuak acara {{{acara}}}}}{{#if:{{{tgl|}}}| pado tangga {{{tgl}}}}}{{#if:{{{di|}}}| di {{{di}}}}}.}}<includeonly>[[Category:Pangguno nan ikuik WikiLatih{{#if:{{{tgl|}}}| tangga {{{tgl}}}}}|{{PAGENAME}}]]</includeonly></div>..."
10359
wikitext
text/x-wiki
<div style="float: right">{{userbox|white|lightgray|[[File:{{{logo|Wikimedia-logo-id.svg}}}|45px|link=]]|Pangguno iko ikuik sato dalam '''[[:wmid:WikiLatih|#WikiLatih]]''' {{{proyek|manyuntiang Wikikato }}} {{#if:{{{acara|}}}| untuak acara {{{acara}}}}}{{#if:{{{tgl|}}}| pado tangga {{{tgl}}}}}{{#if:{{{di|}}}| di {{{di}}}}}.}}<includeonly>[[Category:Pangguno nan ikuik WikiLatih{{#if:{{{tgl|}}}| tangga {{{tgl}}}}}|{{PAGENAME}}]]</includeonly></div>
<noinclude>{{dokumentasi}}</noinclude>
7mi7qe0y695bkq0rmacsyx05ksxw5y3
10371
10359
2026-09-15T02:43:53Z
Zhilal Darma
23
10371
wikitext
text/x-wiki
<div style="float: right">{{Userbox|white|lightgray|[[File:{{{logo|Wikimedia-logo-id.svg}}}|45px|link=]]|Pangguno iko ikuik sato dalam '''[[:wmid:WikiLatih|#WikiLatih]]''' {{{proyek|manyuntiang Wikikato }}} {{#if:{{{acara|}}}| untuak acara {{{acara}}}}}{{#if:{{{tgl|}}}| pado tangga {{{tgl}}}}}{{#if:{{{di|}}}| di {{{di}}}}}.}}<includeonly>[[Category:Pangguno nan ikuik WikiLatih{{#if:{{{tgl|}}}| tangga {{{tgl}}}}}|{{PAGENAME}}]]</includeonly></div>
<noinclude>{{dokumentasi}}</noinclude>
0hsstd0dzudqumwylutpjdqnzv4lq3b
Templat:Userbox
10
2532
10360
2026-09-15T01:53:23Z
Zhilal Darma
23
←Mambuek laman baisi "<onlyinclude>{{#invoke:userbox|userbox}}</onlyinclude> {{Documentation}} <!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->"
10360
wikitext
text/x-wiki
<onlyinclude>{{#invoke:userbox|userbox}}</onlyinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
lr8clh9k6t47irbafe7zotmb3wn7t3j
Templat:Userbox/styles.css
10
2533
10361
2026-09-15T01:54:15Z
Zhilal Darma
23
←Mambuek laman baisi "/* {{pp-template}} */ .wikipediauserbox { margin: 1px; border: 1px solid var(--border-color-base, #a2a9b1); width: 238px; float: left; } .wikipediauserbox table { border-collapse: collapse; width: 238px; margin-bottom: 0; margin-top: 0; background: #eee; color: inherit; } .wikipediauserbox td { border: 0; vertical-align: middle; } .wikipediauserbox .userbox-info { border: 0; text-align: left; font-size: 8pt; padding: 0 4px 0 4px; height: 45px; l..."
10361
sanitized-css
text/css
/* {{pp-template}} */
.wikipediauserbox {
margin: 1px;
border: 1px solid var(--border-color-base, #a2a9b1);
width: 238px;
float: left;
}
.wikipediauserbox table {
border-collapse: collapse;
width: 238px;
margin-bottom: 0;
margin-top: 0;
background: #eee;
color: inherit;
}
.wikipediauserbox td {
border: 0;
vertical-align: middle;
}
.wikipediauserbox .userbox-info {
border: 0;
text-align: left;
font-size: 8pt;
padding: 0 4px 0 4px;
height: 45px;
line-height: 1.25em;
color: inherit;
vertical-align: middle;
}
.wikipediauserbox .userbox-id,
.wikipediauserbox .userbox-id2 {
border: 0;
width: 45px;
height: 45px;
background: #ddd;
text-align: center;
font-size: 14pt;
font-weight: bold;
color: inherit;
padding: 0 1px 0 0;
line-height: 1.25em;
vertical-align: middle;
}
/* Dark mode fixes */
@media screen {
html.skin-theme-clientpref-night .wikipediauserbox table {
background: #202122;
color: inherit;
}
html.skin-theme-clientpref-night .wikipediauserbox .userbox-id,
html.skin-theme-clientpref-night .wikipediauserbox .userbox-id2 {
background: #27292d;
color: inherit;
}
/* Defined background, no foreground color (temporary fix) */
html.skin-theme-clientpref-night .wikipediauserbox table[style*="background"] .userbox-info {
color: #202122;
}
}
@media screen and ( prefers-color-scheme: dark ) {
html.skin-theme-clientpref-os .wikipediauserbox table {
background: #202122;
color: inherit;
}
html.skin-theme-clientpref-os .wikipediauserbox .userbox-id,
html.skin-theme-clientpref-os .wikipediauserbox .userbox-id2 {
background: #27292d;
color: inherit;
}
/* Defined background, no foreground color (temporary fix) */
html.skin-theme-clientpref-os .wikipediauserbox table[style*="background"] .userbox-info {
color: #202122;
color: inherit;
}
}
3sx0tsg194sph82mxluzbxc9jy1uqcl
Modul:Userbox
828
2534
10362
2026-09-15T01:57:14Z
Zhilal Darma
23
←Mambuek laman baisi "-- This module implements {{userbox}}. local categoryHandler = require('Module:Category handler').main local p = {} -------------------------------------------------------------------------------- -- Helper functions -------------------------------------------------------------------------------- local function checkNum(val, default) -- Checks whether a value is a number greater than or equal to zero. If so, -- returns it as a number. If not, returns a default..."
10362
Scribunto
text/plain
-- This module implements {{userbox}}.
local categoryHandler = require('Module:Category handler').main
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function checkNum(val, default)
-- Checks whether a value is a number greater than or equal to zero. If so,
-- returns it as a number. If not, returns a default value.
val = tonumber(val)
if val and val >= 0 then
return val
else
return default
end
end
local function addSuffix(num, suffix)
-- Turns a number into a string and adds a suffix.
if num then
return tostring(num) .. suffix
else
return nil
end
end
local function checkNumAndAddSuffix(num, default, suffix)
-- Checks a value with checkNum and adds a suffix.
num = checkNum(num, default)
return addSuffix(num, suffix)
end
local function makeCat(cat, sort)
-- Makes a category link.
if sort then
return mw.ustring.format('[[Category:%s|%s]]', cat, sort)
else
return mw.ustring.format('[[Category:%s]]', cat)
end
end
--------------------------------------------------------------------------------
-- Argument processing
--------------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local origArgs = require('Module:Arguments').getArgs(frame)
local args = {}
for k, v in pairs(origArgs) do
args[k] = v
end
return p.main(funcName, args)
end
end
p.userbox = makeInvokeFunc('_userbox')
p['userbox-2'] = makeInvokeFunc('_userbox-2')
p['userbox-r'] = makeInvokeFunc('_userbox-r')
--------------------------------------------------------------------------------
-- Main functions
--------------------------------------------------------------------------------
function p.main(funcName, args)
local userboxData = p[funcName](args)
local userbox = p.render(userboxData)
local cats = p.categories(args)
return userbox .. (cats or '')
end
function p._userbox(args)
-- Does argument processing for {{userbox}}.
local data = {}
-- Get div tag values.
data.float = args.float
local borderWidthNum = checkNum(args['border-width'] or args['border-s'], nil)
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderColor = args['border-color'] or args['border-c'] or args[1] or args['id-c']
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.bodyClass = args.bodyclass
-- Get table tag values.
data.backgroundColor = args['info-background'] or args[2] or args['info-c']
-- Get info values.
data.info = args.info or args[4] or "<code>{{{info}}}</code>"
data.infoTextAlign = args['info-a']
data.infoFontSize = checkNumAndAddSuffix(args['info-size'] or args['info-s'], nil, 'pt')
data.infoHeight = checkNumAndAddSuffix(args['logo-height'] or args['id-h'], nil, 'px')
data.infoPadding = args['info-padding'] or args['info-p']
data.infoLineHeight = args['info-line-height'] or args['info-lh']
data.infoColor = args['info-color'] or args['info-fc']
data.infoOtherParams = args['info-other-param'] or args['info-op']
data.infoClass = args['info-class']
-- Get id values.
local id = args.logo or args[3] or args.id
data.id = id
data.showId = id and true or false
data.idWidth = checkNumAndAddSuffix(args['logo-width'] or args['id-w'], nil, 'px')
data.idHeight = checkNumAndAddSuffix(args['logo-height'] or args['id-h'], nil, 'px')
data.idBackgroundColor = args['logo-background'] or args[1] or args['id-c']
data.idTextAlign = args['id-a']
data.idFontSize = checkNum(args['logo-size'] or args[5] or args['id-s'], nil)
data.idColor = args['logo-color'] or args['id-fc'] or data.infoColor
data.idPadding = args['logo-padding'] or args['id-p']
data.idLineHeight = args['logo-line-height'] or args['id-lh']
data.idOtherParams = args['logo-other-param'] or args['id-op']
data.idClass = args['id-class']
return data
end
p['_userbox-2'] = function (args)
-- Does argument processing for {{userbox-2}}.
local data = {}
-- Get div tag values.
data.float = args.float
local borderWidthNum = checkNum(args['border-s'] or args[9], nil)
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderColor = args['border-c'] or args[6] or args['id1-c'] or args[1]
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.bodyClass = args.bodyclass
-- Get table tag values.
data.backgroundColor = args['info-c'] or args[2]
-- Get info values.
data.info = args.info or args[4] or "<code>{{{info}}}</code>"
data.infoTextAlign = args['info-a']
data.infoFontSize = checkNumAndAddSuffix(args['info-s'], nil, 'pt')
data.infoColor = args['info-fc'] or args[8]
data.infoPadding = args['info-p']
data.infoLineHeight = args['info-lh']
data.infoOtherParams = args['info-op']
-- Get id values.
data.showId = true
data.id = args.logo or args[3] or args.id1 or 'id1'
data.idWidth = checkNumAndAddSuffix(args['id1-w'], nil, 'px')
data.idHeight = checkNumAndAddSuffix(args['id-h'], nil, 'px')
data.idBackgroundColor = args['id1-c'] or args[1]
data.idTextAlign = args['id-a']
data.idFontSize = checkNum(args['id1-s'], nil)
data.idLineHeight = args['id1-lh']
data.idColor = args['id1-fc'] or data.infoColor
data.idPadding = args['id1-p']
data.idOtherParams = args['id1-op']
-- Get id2 values.
data.showId2 = true
data.id2 = args.logo or args[5] or args.id2 or 'id2'
data.id2Width = checkNumAndAddSuffix(args['id2-w'], nil, 'px')
data.id2Height = data.idHeight
data.id2BackgroundColor = args['id2-c'] or args[7] or args[1]
data.id2TextAlign = nil -- Always center, but don't set if no content
data.id2FontSize = checkNum(args['id2-s'], nil)
data.id2LineHeight = args['id2-lh']
data.id2Color = args['id2-fc'] or data.infoColor
data.id2Padding = args['id2-p']
data.id2OtherParams = args['id2-op']
return data
end
p['_userbox-r'] = function (args)
-- Does argument processing for {{userbox-r}}.
local data = {}
-- Get div tag values.
data.float = args.float
local borderWidthNum = checkNum(args['border-width'] or args['border-s'], nil)
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderColor = args['border-color'] or args['border-c'] or args[1] or args['id-c']
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.bodyClass = args.bodyclass
-- Get table tag values.
data.backgroundColor = args['info-background'] or args[2] or args['info-c']
-- Get id values.
data.showId = false -- We only show id2 in userbox-r.
-- Get info values.
data.info = args.info or args[4] or "<code>{{{info}}}</code>"
data.infoTextAlign = args['info-align'] or args['info-a']
data.infoFontSize = checkNumAndAddSuffix(args['info-size'] or args['info-s'], nil, 'pt')
data.infoPadding = args['info-padding'] or args['info-p']
data.infoLineHeight = args['info-line-height'] or args['info-lh']
data.infoColor = args['info-color'] or args['info-fc']
data.infoOtherParams = args['info-other-param'] or args['info-op']
-- Get id2 values.
data.showId2 = true -- userbox-r always shows the ID cell (as id2)
data.id2 = args.logo or args[3] or args.id or 'id'
data.id2Width = checkNumAndAddSuffix(args['logo-width'] or args['id-w'], nil, 'px')
data.id2Height = checkNumAndAddSuffix(args['logo-height'] or args['id-h'], nil, 'px')
data.id2BackgroundColor = args['logo-background'] or args[1] or args['id-c']
data.id2TextAlign = args['id-a']
data.id2FontSize = checkNum(args['logo-size'] or args[5] or args['id-s'], nil)
data.id2Color = args['logo-color'] or args['id-fc'] or data.infoColor
data.id2Padding = args['logo-padding'] or args['id-p']
data.id2LineHeight = args['logo-line-height'] or args['id-lh']
data.id2OtherParams = args['logo-other-param'] or args['id-op']
return data
end
function p.render(data)
-- Renders the userbox html using the content of the data table.
-- Add TemplateStyles
local templateStyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Template:Userbox/styles.css' }
}
-- Render the div tag html.
local root = mw.html.create('div')
root:addClass('wikipediauserbox')
-- Only add CSS properties if they have values
if data.float then root:css('float', data.float) end
if data.borderWidth then
root:css('border-width', data.borderWidth)
end
if data.borderColor then
root:css('border-color', data.borderColor)
-- Set border style if we have a color but potentially no width set
if not data.borderWidth then
root:css('border-width', '1px') -- default border width
end
root:css('border-style', 'solid')
end
if data.width then root:css('width', data.width) end
if data.bodyClass then root:addClass(data.bodyClass) end
-- Render the table tag html.
local tableroot = root:tag('table')
tableroot:attr('role', 'presentation')
-- Only add CSS if values exist
if data.width then tableroot:css('width', data.width) end
if data.backgroundColor then tableroot:css('background', data.backgroundColor):css('color', 'inherit') end
local tablerow = tableroot:tag('tr')
-- Create cells based on what should actually be shown
if data.showId == false then
-- userbox-r: info cell first, then id2 cell (if showId2 is true)
local infoCell = tablerow:tag('td')
infoCell:addClass('userbox-info')
if data.infoTextAlign then infoCell:css('text-align', data.infoTextAlign) end
if data.infoFontSize then infoCell:css('font-size', data.infoFontSize) end
if data.infoPadding then infoCell:css('padding', data.infoPadding) end
if data.infoHeight then infoCell:css('height', data.infoHeight) end
if data.infoLineHeight then infoCell:css('line-height', data.infoLineHeight) end
if data.infoColor then infoCell:css('color', data.infoColor) end
if data.infoOtherParams then infoCell:cssText(data.infoOtherParams) end
if data.infoClass then infoCell:addClass(data.infoClass) end
if data.info then infoCell:wikitext(data.info) end
-- Create id2 cell only if showId2 is true
if data.showId2 then
local id2Cell = tablerow:tag('td')
id2Cell:addClass('userbox-id2')
if data.id2Width then id2Cell:css('width', data.id2Width) end
if data.id2Height then id2Cell:css('height', data.id2Height) end
if data.id2BackgroundColor then id2Cell:css('background', data.id2BackgroundColor) end
if data.id2TextAlign then id2Cell:css('text-align', data.id2TextAlign) end
if data.id2FontSize then id2Cell:css('font-size', data.id2FontSize .. 'pt') end
if data.id2Color then id2Cell:css('color', data.id2Color) else id2Cell:css('color', 'inherit') end
if data.id2Padding then id2Cell:css('padding', data.id2Padding) end
if data.id2LineHeight then id2Cell:css('line-height', data.id2LineHeight) end
if data.id2OtherParams then id2Cell:cssText(data.id2OtherParams) end
if data.id2 then id2Cell:wikitext(data.id2) end
end
else
-- userbox and userbox-2: create id cell only if showId is true
if data.showId then
local idCell = tablerow:tag('td')
idCell:addClass('userbox-id')
if data.idWidth then idCell:css('width', data.idWidth) end
if data.idHeight then idCell:css('height', data.idHeight) end
if data.idBackgroundColor then idCell:css('background', data.idBackgroundColor) end
if data.idTextAlign then idCell:css('text-align', data.idTextAlign) end
if data.idFontSize then idCell:css('font-size', data.idFontSize .. 'pt') end
if data.idColor then idCell:css('color', data.idColor) else idCell:css('color', 'inherit') end
if data.idPadding then idCell:css('padding', data.idPadding) end
if data.idLineHeight then idCell:css('line-height', data.idLineHeight) end
if data.idOtherParams then idCell:cssText(data.idOtherParams) end
if data.idClass then idCell:addClass(data.idClass) end
if data.id then idCell:wikitext(data.id) end
end
-- Always create info cell for userbox and userbox-2
local infoCell = tablerow:tag('td')
infoCell:addClass('userbox-info')
if data.infoTextAlign then infoCell:css('text-align', data.infoTextAlign) end
if data.infoFontSize then infoCell:css('font-size', data.infoFontSize) end
if data.infoPadding then infoCell:css('padding', data.infoPadding) end
if data.infoHeight then infoCell:css('height', data.infoHeight) end
if data.infoLineHeight then infoCell:css('line-height', data.infoLineHeight) end
if data.infoColor then infoCell:css('color', data.infoColor) end
if data.infoOtherParams then infoCell:cssText(data.infoOtherParams) end
if data.infoClass then infoCell:addClass(data.infoClass) end
if data.info then infoCell:wikitext(data.info) end
-- Create id2 cell only for userbox-2 and only if showId2 is true
if data.showId2 then
local id2Cell = tablerow:tag('td')
id2Cell:addClass('userbox-id2')
if data.id2Width then id2Cell:css('width', data.id2Width) end
if data.id2Height then id2Cell:css('height', data.id2Height) end
if data.id2BackgroundColor then id2Cell:css('background', data.id2BackgroundColor) end
if data.id2TextAlign then id2Cell:css('text-align', data.id2TextAlign) end
if data.id2FontSize then id2Cell:css('font-size', data.id2FontSize .. 'pt') end
if data.id2Color then id2Cell:css('color', data.id2Color) else id2Cell:css('color', 'inherit') end
if data.id2Padding then id2Cell:css('padding', data.id2Padding) end
if data.id2LineHeight then id2Cell:css('line-height', data.id2LineHeight) end
if data.id2OtherParams then id2Cell:cssText(data.id2OtherParams) end
if data.id2 then id2Cell:wikitext(data.id2) end
end
end
local title = mw.title.getCurrentTitle()
if (title.namespace == 2) and not title.text:match("/") then
return templateStyles .. tostring(root) -- regular user page
elseif title.namespace == 14 then
return templateStyles .. tostring(root) -- category
elseif title.isTalkPage then
return templateStyles .. tostring(root) -- talk page
end
-- Color contrast checking (simplified for TemplateStyles)
local legible = true
local contrast = require('Module:Color contrast')._ratio
local function has_text(wikitext)
if not wikitext then return false end
wikitext = wikitext:gsub("]]", "|]]")
wikitext = wikitext:gsub("%[%[%s*[Mm][Ee][Dd][Ii][Aa]%s*:[^|]-(|.-)]]", "")
wikitext = wikitext:gsub("%[%[%s*[Ii][Mm][Aa][Gg][Ee]%s*:[^|]-(|.-)]]", "")
wikitext = wikitext:gsub("%[%[%s*[Ff][Ii][Ll][Ee]%s*:[^|]-(|.-)]]", "")
return mw.text.trim(wikitext) ~= ""
end
if data.infoColor and data.backgroundColor and contrast { data.infoColor, data.backgroundColor, error = 0 } < 4.5 then
legible = false
end
-- For bold text >= 14pt, requirement is only 3.
local idContrastThreshold = 4.5
local id2ContrastThreshold = 4.5
if (data.idFontSize or 0) >= 14 then idContrastThreshold = 3 end
if (data.id2FontSize or 0) >= 14 then id2ContrastThreshold = 3 end
if data.showId and data.idColor and data.idBackgroundColor and contrast { data.idColor, data.idBackgroundColor, error = 0 } < idContrastThreshold then
if has_text(data.id or "") then legible = false end
end
if data.showId2 and data.id2Color and data.id2BackgroundColor and contrast { data.id2Color, data.id2BackgroundColor, error = 0 } < id2ContrastThreshold then
if has_text(data.id2 or "") then legible = false end
end
if not legible then
root:wikitext('[[Category:Userboxes with insufficient color contrast]]')
end
return templateStyles .. tostring(root)
end
function p.categories(args, page)
-- Gets categories from [[Module:Category handler]].
-- The page parameter makes the function act as though the module was being called from that page.
-- It is included for testing purposes.
local cats = {}
cats[#cats + 1] = args.usercategory
cats[#cats + 1] = args.usercategory2
cats[#cats + 1] = args.usercategory3
cats[#cats + 1] = args.usercategory4
cats[#cats + 1] = args.usercategory5
-- Get the title object
local title
if page then
title = mw.title.new(page)
else
title = mw.title.getCurrentTitle()
end
-- Build category handler arguments.
local chargs = {}
chargs.page = page
chargs.nocat = args.nocat
chargs.main = '[[Category:Pages with templates in the wrong namespace]]'
if args.notcatsubpages then
chargs.subpage = 'no'
end
-- User namespace.
local user = ''
for i, cat in ipairs(cats) do
user = user .. makeCat(cat)
end
chargs.user = user
return categoryHandler(chargs)
end
return p
310mo9tctsu9310xhk46tk6d7jx8wl9
Modul:Yesno
828
2535
10363
2026-09-15T02:06:38Z
Zhilal Darma
23
←Mambuek laman baisi "-- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template {{yesno}}. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or..."
10363
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
swdskn7svew8i9wuydn9uj5l3r2ghcs
Modul:Arguments
828
2536
10364
2026-09-15T02:07:28Z
Zhilal Darma
23
←Mambuek laman baisi "-- This module provides easy processing of arguments passed to Scribunto from -- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly. local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local arguments = {} -- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it. local function tidyValDefault(key, val) if type(val) == 'str..."
10364
Scribunto
text/plain
-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
5qx9tzlul9ser30uxj9nbasjt92cevn
Templat:Wikilatih/dokumentasi
10
2537
10365
2026-09-15T02:10:38Z
Zhilal Darma
23
←Mambuek laman baisi "Parameter: *proyek: buliah diisi jo keterangan labiah rincinyo cando "manambah contoh kalimat Wikikato". ndak diisi ndak baa juo, pengaturan asalnyi "manyuntiang Wikikato" *acara: buliah diisi kalau Wikilatih ko bagian dari suatu rangkaian acara. *di: buliah diisi jo tampek kegiatan Wikilatih tu. *tgl: buliah diisi jo tanggal kegiatan Wikilatih tu. Contoh: <pre>{{Wikilatih}}</pre> jadinyo {{Wikilatih}} <br> Contoh lain, <pre>{{Wikilatih|acara=Sarayo XYZ|di=M..."
10365
wikitext
text/x-wiki
Parameter:
*proyek: buliah diisi jo keterangan labiah rincinyo cando "manambah contoh kalimat Wikikato". ndak diisi ndak baa juo, pengaturan asalnyi "manyuntiang Wikikato"
*acara: buliah diisi kalau Wikilatih ko bagian dari suatu rangkaian acara.
*di: buliah diisi jo tampek kegiatan Wikilatih tu.
*tgl: buliah diisi jo tanggal kegiatan Wikilatih tu.
Contoh:
<pre>{{Wikilatih}}</pre>
jadinyo
{{Wikilatih}}
<br>
Contoh lain,
<pre>{{Wikilatih|acara=Sarayo XYZ|di=Mana-Mana Hatiku Senang|tgl=31 Februari 2026}}</pre>
jadinyo
{{Wikilatih|acara=Sarayo XYZ|di=Mana-Mana Hatiku Senang|tgl=31 Februari 2026}}
70d595q94l8yht1p3rcrb3fw3op5txy
Modul:Category handler
828
2538
10366
2026-09-15T02:13:55Z
Zhilal Darma
23
←Mambuek laman baisi "-------------------------------------------------------------------------------- -- -- -- CATEGORY HANDLER -- -- -- -- This module implements the {{category handler}} template in Lua, -- -- with a few improvements: all namespaces and all namespace..."
10366
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- CATEGORY HANDLER --
-- --
-- This module implements the {{category handler}} template in Lua, --
-- with a few improvements: all namespaces and all namespace aliases --
-- are supported, and namespace names are detected automatically for --
-- the local wiki. This module requires [[Module:Namespace detect]] --
-- and [[Module:Yesno]] to be available on the local wiki. It can be --
-- configured for different wikis by altering the values in --
-- [[Module:Category handler/config]], and pages can be blacklisted --
-- from categorisation by using [[Module:Category handler/blacklist]]. --
-- --
--------------------------------------------------------------------------------
-- Load required modules
local yesno = require('Module:Yesno')
-- Lazily load things we don't always need
local mShared, mappings
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function trimWhitespace(s, removeBlanks)
if type(s) ~= 'string' then
return s
end
s = s:match('^%s*(.-)%s*$')
if removeBlanks then
if s ~= '' then
return s
else
return nil
end
else
return s
end
end
--------------------------------------------------------------------------------
-- CategoryHandler class
--------------------------------------------------------------------------------
local CategoryHandler = {}
CategoryHandler.__index = CategoryHandler
function CategoryHandler.new(data, args)
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename = obj:parameter('demopage')
local success, titleObj
if pagename then
success, titleObj = pcall(mw.title.new, pagename)
end
if success and titleObj then
obj.title = titleObj
if titleObj == mw.title.getCurrentTitle() then
obj._usesCurrentTitle = true
end
else
obj.title = mw.title.getCurrentTitle()
obj._usesCurrentTitle = true
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = obj:parameter(key)
value = trimWhitespace(value, true)
obj['_' .. key] = yesno(value)
end
do
local subpage = obj:parameter('subpage')
local category2 = obj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
end
if type(category2) == 'string' then
subpage = mw.ustring.lower(category2)
end
obj._subpage = trimWhitespace(subpage, true)
obj._category2 = trimWhitespace(category2) -- don't remove blank values
end
return obj
end
function CategoryHandler:parameter(key)
local parameterNames = self._data.parameters[key]
local pntype = type(parameterNames)
if pntype == 'string' or pntype == 'number' then
return self._args[parameterNames]
elseif pntype == 'table' then
for _, name in ipairs(parameterNames) do
local value = self._args[name]
if value ~= nil then
return value
end
end
return nil
else
error(string.format(
'invalid config key "%s"',
tostring(key)
), 2)
end
end
function CategoryHandler:isSuppressedByArguments()
return
-- See if a category suppression argument has been set.
self._nocat == true
or self._categories == false
or (
self._category2
and self._category2 ~= self._data.category2Yes
and self._category2 ~= self._data.category2Negative
)
-- Check whether we are on a subpage, and see if categories are
-- suppressed based on our subpage status.
or self._subpage == self._data.subpageNo and self.title.isSubpage
or self._subpage == self._data.subpageOnly and not self.title.isSubpage
end
function CategoryHandler:shouldSkipBlacklistCheck()
-- Check whether the category suppression arguments indicate we
-- should skip the blacklist check.
return self._nocat == false
or self._categories == true
or self._category2 == self._data.category2Yes
end
function CategoryHandler:matchesBlacklist()
if self._usesCurrentTitle then
return self._data.currentTitleMatchesBlacklist
else
mShared = mShared or require('Module:Category handler/shared')
return mShared.matchesBlacklist(
self.title.prefixedText,
mw.loadData('Module:Category handler/blacklist')
)
end
end
function CategoryHandler:isSuppressed()
-- Find if categories are suppressed by either the arguments or by
-- matching the blacklist.
return self:isSuppressedByArguments()
or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist()
end
function CategoryHandler:getNamespaceParameters()
if self._usesCurrentTitle then
return self._data.currentTitleNamespaceParameters
else
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
return mShared.getNamespaceParameters(
self.title,
mappings
)
end
end
function CategoryHandler:namespaceParametersExist()
-- Find whether any namespace parameters have been specified.
-- We use the order "all" --> namespace params --> "other" as this is what
-- the old template did.
if self:parameter('all') then
return true
end
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
for ns, params in pairs(mappings) do
for i, param in ipairs(params) do
if self._args[param] then
return true
end
end
end
if self:parameter('other') then
return true
end
return false
end
function CategoryHandler:getCategories()
local params = self:getNamespaceParameters()
local nsCategory
for i, param in ipairs(params) do
local value = self._args[param]
if value ~= nil then
nsCategory = value
break
end
end
if nsCategory ~= nil or self:namespaceParametersExist() then
-- Namespace parameters exist - advanced usage.
if nsCategory == nil then
nsCategory = self:parameter('other')
end
local ret = {self:parameter('all')}
local numParam = tonumber(nsCategory)
if numParam and numParam >= 1 and math.floor(numParam) == numParam then
-- nsCategory is an integer
ret[#ret + 1] = self._args[numParam]
else
ret[#ret + 1] = nsCategory
end
if #ret < 1 then
return nil
else
return table.concat(ret)
end
elseif self._data.defaultNamespaces[self.title.namespace] then
-- Namespace parameters don't exist, simple usage.
return self._args[1]
end
return nil
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- Used for testing purposes.
return {
CategoryHandler = CategoryHandler
}
end
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler.new(data, args)
if handler:isSuppressed() then
return nil
end
return handler:getCategories()
end
function p.main(frame, data)
data = data or mw.loadData('Module:Category handler/data')
local args = require('Module:Arguments').getArgs(frame, {
wrappers = data.wrappers,
valueFunc = function (k, v)
v = trimWhitespace(v)
if type(k) == 'number' then
if v ~= '' then
return v
else
return nil
end
else
return v
end
end
})
return p._main(args, data)
end
return p
letwavu3yvlayfzew66uuwixmwebq5b
Modul:Color contrast
828
2539
10367
2026-09-15T02:15:38Z
Zhilal Darma
23
←Mambuek laman baisi "-- -- This module implements -- {{Color contrast ratio}} -- {{Greater color contrast ratio}} -- {{ColorToLum}} -- {{RGBColorToLum}} -- local p = {} local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' ) local function sRGB ( v ) if (v <= 0.03928) then v = v / 12.92 else v = math.pow((v+0.055)/1.055, 2.4) end return v end local function rgbdec2lum( R, G, B ) if ( 0 <= R and R < 256 and 0 <= G and G < 256 and 0 <= B and B < 256 ) then retu..."
10367
Scribunto
text/plain
--
-- This module implements
-- {{Color contrast ratio}}
-- {{Greater color contrast ratio}}
-- {{ColorToLum}}
-- {{RGBColorToLum}}
--
local p = {}
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
local function sRGB ( v )
if (v <= 0.03928) then
v = v / 12.92
else
v = math.pow((v+0.055)/1.055, 2.4)
end
return v
end
local function rgbdec2lum( R, G, B )
if ( 0 <= R and R < 256 and 0 <= G and G < 256 and 0 <= B and B < 256 ) then
return 0.2126 * sRGB(R/255) + 0.7152 * sRGB(G/255) + 0.0722 * sRGB(B/255)
else
return ''
end
end
local function hsl2lum( h, s, l )
if ( 0 <= h and h < 360 and 0 <= s and s <= 1 and 0 <= l and l <= 1 ) then
local c = (1 - math.abs(2*l - 1))*s
local x = c*(1 - math.abs( math.fmod(h/60, 2) - 1) )
local m = l - c/2
local r, g, b = m, m, m
if( 0 <= h and h < 60 ) then
r = r + c
g = g + x
elseif( 60 <= h and h < 120 ) then
r = r + x
g = g + c
elseif( 120 <= h and h < 180 ) then
g = g + c
b = b + x
elseif( 180 <= h and h < 240 ) then
g = g + x
b = b + c
elseif( 240 <= h and h < 300 ) then
r = r + x
b = b + c
elseif( 300 <= h and h < 360 ) then
r = r + c
b = b + x
end
return rgbdec2lum(255*r, 255*g, 255*b)
else
return ''
end
end
local function color2lum( c )
if (c == nil) then
return ''
end
-- whitespace
c = c:match( '^%s*(.-)[%s;]*$' )
-- unstrip nowiki strip markers
c = mw.text.unstripNoWiki(c)
-- lowercase
c = c:lower()
-- first try to look it up
local L = HTMLcolor[c]
if (L ~= nil) then
return L
end
-- convert from hsl
if mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9%.]*[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local h, s, l = mw.ustring.match(c,'^hsl%([%s]*([0-9][0-9%.]*)[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return hsl2lum(tonumber(h), tonumber(s)/100, tonumber(l)/100)
end
-- convert from rgb
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*%)$')
return rgbdec2lum(tonumber(R), tonumber(G), tonumber(B))
end
-- convert from rgb percent
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return rgbdec2lum(255*tonumber(R)/100, 255*tonumber(G)/100, 255*tonumber(B)/100)
end
-- remove leading # (if there is one) and whitespace
c = mw.ustring.match(c, '^[%s#]*([a-f0-9]*)[%s]*$')
-- split into rgb
local cs = mw.text.split(c or '', '')
if( #cs == 6 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[2])
local G = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4])
local B = 16*tonumber('0x' .. cs[5]) + tonumber('0x' .. cs[6])
return rgbdec2lum(R, G, B)
elseif ( #cs == 3 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[1])
local G = 16*tonumber('0x' .. cs[2]) + tonumber('0x' .. cs[2])
local B = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[3])
return rgbdec2lum(R, G, B)
end
-- failure, return blank
return ''
end
function p._greatercontrast(args)
local bias = tonumber(args['bias'] or '0') or 0
local v1 = color2lum(args[1] or '')
local c2 = args[2] or '#FFFFFF'
local v2 = color2lum(c2)
local c3 = args[3] or '#000000'
local v3 = color2lum(c3)
local ratio1 = 0;
local ratio2 = 0;
if (type(v1) == 'number' and type(v2) == 'number') then
ratio1 = (v2 + 0.05)/(v1 + 0.05)
ratio1 = (ratio1 < 1) and 1/ratio1 or ratio1
end
if (type(v1) == 'number' and type(v3) == 'number') then
ratio2 = (v3 + 0.05)/(v1 + 0.05)
ratio2 = (ratio2 < 1) and 1/ratio2 or ratio2
end
return (ratio1 + bias > ratio2) and c2 or c3
end
function p._ratio(args)
local v1 = color2lum(args[1])
local v2 = color2lum(args[2])
if (type(v1) == 'number' and type(v2) == 'number') then
-- v1 should be the brighter of the two.
if v2 > v1 then
v1, v2 = v2, v1
end
return (v1 + 0.05)/(v2 + 0.05)
else
return args['error'] or '?'
end
end
function p._styleratio(args)
local style = (args[1] or ''):lower()
local bg, fg = 'white', 'black'
local lum_bg, lum_fg = 1, 0
if args[2] then
local lum = color2lum(args[2])
if lum ~= '' then bg, lum_bg = args[2], lum end
end
if args[3] then
local lum = color2lum(args[3])
if lum ~= '' then fg, lum_fg = args[3], lum end
end
local slist = mw.text.split(style or '', ';')
for k = 1,#slist do
s = slist[k]
local k,v = s:match( '^[%s]*([^:]-):([^:]-)[%s;]*$' )
k = k or ''
v = v or ''
if (k:match('^[%s]*(background)[%s]*$') or k:match('^[%s]*(background%-color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_bg = v, lum end
elseif (k:match('^[%s]*(color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_fg = v, lum end
end
end
if lum_bg > lum_fg then
return (lum_bg + 0.05)/(lum_fg + 0.05)
else
return (lum_fg + 0.05)/(lum_bg + 0.05)
end
end
function p.lum(frame)
return color2lum(frame.args[1] or frame:getParent().args[1])
end
function p.ratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._ratio(args)
end
function p.styleratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._styleratio(args)
end
function p.greatercontrast(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._greatercontrast(args)
end
return p
hvtmcsb4mviz7lzj6tgvyp5kohk0vr7
Modul:Color contrast/colors
828
2540
10368
2026-09-15T02:16:50Z
Zhilal Darma
23
←Mambuek laman baisi "return { aliceblue = 0.92880068253475, antiquewhite = 0.84646951707754, aqua = 0.7874, aquamarine = 0.8078549208338, azure = 0.97265264954166, beige = 0.8988459998705, bisque = 0.80732327372979, black = 0, blanchedalmond = 0.85084439608156, blue = 0.0722, blueviolet = 0.12622014321946, brown = 0.0982242878..."
10368
Scribunto
text/plain
return {
aliceblue = 0.92880068253475,
antiquewhite = 0.84646951707754,
aqua = 0.7874,
aquamarine = 0.8078549208338,
azure = 0.97265264954166,
beige = 0.8988459998705,
bisque = 0.80732327372979,
black = 0,
blanchedalmond = 0.85084439608156,
blue = 0.0722,
blueviolet = 0.12622014321946,
brown = 0.098224287876511,
burlywood = 0.51559844533893,
cadetblue = 0.29424681085422,
chartreuse = 0.76032025902623,
chocolate = 0.23898526114557,
coral = 0.37017930872924,
cornflowerblue = 0.30318641994179,
cornsilk = 0.93562110372965,
crimson = 0.16042199953026,
cyan = 0.7874,
darkblue = 0.018640801980939,
darkcyan = 0.20329317839046,
darkgoldenrod = 0.27264703559993,
darkgray = 0.39675523072563,
darkgreen = 0.091143429047575,
darkgrey = 0.39675523072563,
darkkhaki = 0.45747326349994,
darkmagenta = 0.07353047651207,
darkolivegreen = 0.12651920884889,
darkorange = 0.40016167026524,
darkorchid = 0.13413142174857,
darkred = 0.054889674531132,
darksalmon = 0.40541471563381,
darkseagreen = 0.43789249325969,
darkslateblue = 0.065792846227988,
darkslategray = 0.067608151928044,
darkslategrey = 0.067608151928044,
darkturquoise = 0.4874606277449,
darkviolet = 0.10999048339343,
deeppink = 0.23866895828276,
deepskyblue = 0.44481603395575,
dimgray = 0.14126329114027,
dimgrey = 0.14126329114027,
dodgerblue = 0.27442536991456,
firebrick = 0.10724525535015,
floralwhite = 0.95922484825004,
forestgreen = 0.18920812076002,
fuchsia = 0.2848,
gainsboro = 0.71569350050648,
ghostwhite = 0.94311261886323,
gold = 0.69860877428159,
goldenrod = 0.41919977809569,
gray = 0.2158605001139,
green = 0.15438342968146,
greenyellow = 0.80609472611453,
grey = 0.2158605001139,
honeydew = 0.96336535554782,
hotpink = 0.34658438169715,
indianred = 0.21406134963884,
indigo = 0.03107561486337,
ivory = 0.99071270600615,
khaki = 0.77012343394121,
lavender = 0.80318750514521,
lavenderblush = 0.90172748631046,
lawngreen = 0.73905893124963,
lemonchiffon = 0.94038992245622,
lightblue = 0.63709141280807,
lightcoral = 0.35522120733135,
lightcyan = 0.94587293494829,
lightgoldenrodyellow = 0.93348351018297,
lightgray = 0.65140563741982,
lightgreen = 0.69091979956865,
lightgrey = 0.65140563741982,
lightpink = 0.58566152734898,
lightsalmon = 0.4780675225206,
lightseagreen = 0.35050145117042,
lightskyblue = 0.56195637618331,
lightslategray = 0.23830165007287,
lightslategrey = 0.23830165007287,
lightsteelblue = 0.53983888284666,
lightyellow = 0.98161818392882,
lime = 0.7152,
limegreen = 0.44571042246098,
linen = 0.88357340984379,
magenta = 0.2848,
maroon = 0.045891942324215,
mediumaquamarine = 0.49389703310801,
mediumblue = 0.044077780212328,
mediumorchid = 0.21639251153773,
mediumpurple = 0.22905858091648,
mediumseagreen = 0.34393112338131,
mediumslateblue = 0.20284629471622,
mediumspringgreen = 0.70704308194184,
mediumturquoise = 0.5133827926448,
mediumvioletred = 0.14371899849357,
midnightblue = 0.02071786635086,
mintcream = 0.97834604947588,
mistyrose = 0.82183047859185,
moccasin = 0.80083000991567,
navajowhite = 0.76519682342785,
navy = 0.015585128108224,
oldlace = 0.91900633405549,
olive = 0.20027537200568,
olivedrab = 0.22593150951929,
orange = 0.4817026703631,
orangered = 0.25516243753416,
orchid = 0.31348806761439,
palegoldenrod = 0.78792647887614,
palegreen = 0.77936759006353,
paleturquoise = 0.76436077921714,
palevioletred = 0.28754994117889,
papayawhip = 0.87797100199835,
peachpuff = 0.74905589878251,
peru = 0.30113074877936,
pink = 0.63271070702466,
plum = 0.45734221587969,
powderblue = 0.68254586500605,
purple = 0.061477070432439,
rebeccapurple = 0.07492341159447,
red = 0.2126,
rosybrown = 0.32319457649407,
royalblue = 0.16663210743188,
saddlebrown = 0.097922285020521,
salmon = 0.36977241527596,
sandybrown = 0.46628543696283,
seagreen = 0.19734199706275,
seashell = 0.92737862206922,
sienna = 0.13697631337098,
silver = 0.52711512570581,
skyblue = 0.55291668518184,
slateblue = 0.14784278062136,
slategray = 0.20896704076536,
slategrey = 0.20896704076536,
snow = 0.96533341834849,
springgreen = 0.73052306068529,
steelblue = 0.20562642207625,
tan = 0.48237604163921,
teal = 0.16996855778968,
thistle = 0.56818401093733,
tomato = 0.30638612719415,
turquoise = 0.5895536427578,
violet = 0.40315452986676,
wheat = 0.74909702820482,
white = 1,
whitesmoke = 0.91309865179342,
yellow = 0.9278,
yellowgreen = 0.50762957208707,
}
chi69ar1btd4wp6xbk3uez6sfu0vipn
Modul:Category handler/data
828
2541
10369
2026-09-15T02:36:30Z
Zhilal Darma
23
←Mambuek laman baisi "-- This module assembles data to be passed to [[Module:Category handler]] using -- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist. local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle() data.currentTitleMatchesBlacklist = mShared.matchesBlackl..."
10369
Scribunto
text/plain
-- This module assembles data to be passed to [[Module:Category handler]] using
-- mw.loadData. This includes the configuration data and whether the current
-- page matches the title blacklist.
local data = require('Module:Category handler/config')
local mShared = require('Module:Category handler/shared')
local blacklist = require('Module:Category handler/blacklist')
local title = mw.title.getCurrentTitle()
data.currentTitleMatchesBlacklist = mShared.matchesBlacklist(
title.prefixedText,
blacklist
)
data.currentTitleNamespaceParameters = mShared.getNamespaceParameters(
title,
mShared.getParamMappings()
)
return data
k26mwixuaeijisfddb0sxkg82iux8v4
Modul:Category handler/config
828
2542
10370
2026-09-15T02:40:45Z
Zhilal Darma
23
←Mambuek laman baisi "-------------------------------------------------------------------------------- -- [[Module:Category handler]] configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see [[Module:Category handler/blacklist]]. -- -------------------------------------------------------------------------------- local cfg = {} -- Don't edit this line. -----------------------..."
10370
Scribunto
text/plain
--------------------------------------------------------------------------------
-- [[Module:Category handler]] configuration data --
-- Language-specific parameter names and values can be set here. --
-- For blacklist config, see [[Module:Category handler/blacklist]]. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- foo = 'parameter name', --
-- --
-- To add multiple names, you can use this format: --
-- --
-- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --
--------------------------------------------------------------------------------
cfg.parameters = {
-- The nocat and categories parameter suppress
-- categorisation. They are used with Module:Yesno, and work as follows:
--
-- cfg.nocat:
-- Result of yesno() Effect
-- true Categorisation is suppressed
-- false Categorisation is allowed, and
-- the blacklist check is skipped
-- nil Categorisation is allowed
--
-- cfg.categories:
-- Result of yesno() Effect
-- true Categorisation is allowed, and
-- the blacklist check is skipped
-- false Categorisation is suppressed
-- nil Categorisation is allowed
nocat = 'nocat',
categories = 'categories',
-- The parameter name for the legacy "category2" parameter. This skips the
-- blacklist if set to the cfg.category2Yes value, and suppresses
-- categorisation if present but equal to anything other than
-- cfg.category2Yes or cfg.category2Negative.
category2 = 'category2',
-- cfg.subpage is the parameter name to specify how to behave on subpages.
subpage = 'subpage',
-- The parameter for data to return in all namespaces.
all = 'all',
-- The parameter name for data to return if no data is specified for the
-- namespace that is detected.
other = 'other',
-- The parameter name used to specify a page other than the current page;
-- used for testing and demonstration.
demopage = 'page',
}
--------------------------------------------------------------------------------
-- Parameter values --
-- These are set values that can be used with certain parameters. Only one --
-- value can be specified, like this: --
-- --
-- cfg.foo = 'value name' -- --
--------------------------------------------------------------------------------
-- The following settings are used with the cfg.category2 parameter. Setting
-- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2
-- is present but equal to anything other than cfg.category2Yes or
-- cfg.category2Negative then it supresses cateogrisation.
cfg.category2Yes = 'yes'
cfg.category2Negative = '¬'
-- The following settings are used with the cfg.subpage parameter.
-- cfg.subpageNo is the value to specify to not categorise on subpages;
-- cfg.subpageOnly is the value to specify to only categorise on subpages.
cfg.subpageNo = 'no'
cfg.subpageOnly = 'only'
--------------------------------------------------------------------------------
-- Default namespaces --
-- This is a table of namespaces to categorise by default. The keys are the --
-- namespace numbers. --
--------------------------------------------------------------------------------
cfg.defaultNamespaces = {
[ 0] = true, -- main
[ 6] = true, -- file
[ 12] = true, -- help
[ 14] = true, -- category
[100] = true, -- portal
[108] = true, -- book
}
--------------------------------------------------------------------------------
-- Wrappers --
-- This is a wrapper template or a list of wrapper templates to be passed to --
-- [[Module:Arguments]]. --
--------------------------------------------------------------------------------
cfg.wrappers = 'Template:Category handler'
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
6ga9hbq2pdwalsvx68i53dmbr421rq5
Modul:Category handler/shared
828
2543
10372
2026-09-15T02:45:01Z
Zhilal Darma
23
←Mambuek laman baisi "-- This module contains shared functions used by [[Module:Category handler]] -- and its submodules. local p = {} function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else re..."
10372
Scribunto
text/plain
-- This module contains shared functions used by [[Module:Category handler]]
-- and its submodules.
local p = {}
function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end
function p.getParamMappings(useLoadData)
local dataPage = 'Module:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end
function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end
return p
omlsnhudxz6juptvtxz7ns97jutbzc5
Modul:Category handler/blacklist
828
2544
10373
2026-09-15T02:47:28Z
Zhilal Darma
23
←Mambuek laman baisi "-- This module contains the blacklist used by [[Module:Category handler]]. -- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested. return { '^Main Page$', -- don't categorise the main page. -- Don't categorise the following pages or their subpages. -- "%f[/\0]" matches if the next character is "/" or the end of the string. '^Wikipedia:Cascade%-protected items%f[/\0]', '^User:UBX%f[/\0]', -- The u..."
10373
Scribunto
text/plain
-- This module contains the blacklist used by [[Module:Category handler]].
-- Pages that match Lua patterns in this list will not be categorised unless
-- categorisation is explicitly requested.
return {
'^Main Page$', -- don't categorise the main page.
-- Don't categorise the following pages or their subpages.
-- "%f[/\0]" matches if the next character is "/" or the end of the string.
'^Wikipedia:Cascade%-protected items%f[/\0]',
'^User:UBX%f[/\0]', -- The userbox "template" space.
'^User talk:UBX%f[/\0]',
-- Don't categorise subpages of these pages, but allow
-- categorisation of the base page.
'^Wikipedia:Template index/.*$',
-- Don't categorise archives.
'/[aA]rchive',
"^Wikipedia:Administrators' noticeboard/IncidentArchive%d+$",
}
fsv1drcay6t25e91hzhqxtyp7pckbpx
Modul:Namespace detect/data
828
2545
10374
2026-09-15T02:50:57Z
Zhilal Darma
23
←Mambuek laman baisi "-------------------------------------------------------------------------------- -- Namespace detect data -- -- This module holds data for [[Module:Namespace detect]] to be loaded per -- -- page, rather than per #invoke, for performance reasons. -- -------------------------------------------------------------------------------- local cfg = require('Module:Namespace detect/config') local fun..."
10374
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect data --
-- This module holds data for [[Module:Namespace detect]] to be loaded per --
-- page, rather than per #invoke, for performance reasons. --
--------------------------------------------------------------------------------
local cfg = require('Module:Namespace detect/config')
local function addKey(t, key, defaultKey)
if key ~= defaultKey then
t[#t + 1] = key
end
end
-- Get a table of parameters to query for each default parameter name.
-- This allows wikis to customise parameter names in the cfg table while
-- ensuring that default parameter names will always work. The cfg table
-- values can be added as a string, or as an array of strings.
local defaultKeys = {
'main',
'talk',
'other',
'subjectns',
'demospace',
'demopage'
}
local argKeys = {}
for i, defaultKey in ipairs(defaultKeys) do
argKeys[defaultKey] = {defaultKey}
end
for defaultKey, t in pairs(argKeys) do
local cfgValue = cfg[defaultKey]
local cfgValueType = type(cfgValue)
if cfgValueType == 'string' then
addKey(t, cfgValue, defaultKey)
elseif cfgValueType == 'table' then
for i, key in ipairs(cfgValue) do
addKey(t, key, defaultKey)
end
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.
end
local function getParamMappings()
--[[
-- Returns a table of how parameter names map to namespace names. The keys
-- are the actual namespace names, in lower case, and the values are the
-- possible parameter names for that namespace, also in lower case. The
-- table entries are structured like this:
-- {
-- [''] = {'main'},
-- ['wikipedia'] = {'wikipedia', 'project', 'wp'},
-- ...
-- }
--]]
local mappings = {}
local mainNsName = mw.site.subjectNamespaces[0].name
mainNsName = mw.ustring.lower(mainNsName)
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = mw.ustring.lower(ns.name)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
table.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
return mappings
end
return {
argKeys = argKeys,
cfg = cfg,
mappings = getParamMappings()
}
ojp6d3pc8mql5nufaqdg576c9so3479
Modul:Namespace detect/config
828
2546
10375
2026-09-15T02:53:17Z
Zhilal Darma
23
←Mambuek laman baisi "-------------------------------------------------------------------------------- -- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- --..."
10375
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect configuration data --
-- --
-- This module stores configuration data for Module:Namespace detect. Here --
-- you can localise the module to your wiki's language. --
-- --
-- To activate a configuration item, you need to uncomment it. This means --
-- that you need to remove the text "-- " at the start of the line. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. Values added --
-- here will work in addition to the default English parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- cfg.foo = 'parameter name' --
-- --
-- To add multiple names, you can use this format: --
-- --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --
--------------------------------------------------------------------------------
---- This parameter displays content for the main namespace:
-- cfg.main = 'main'
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
---- This parameter sets a specific page to compare:
cfg.demopage = 'page'
--------------------------------------------------------------------------------
-- Table configuration --
-- These configuration items allow customisation of the "table" function, --
-- used to generate a table of possible parameters in the module --
-- documentation. --
--------------------------------------------------------------------------------
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
--------------------------------------------------------------------------------
-- End of configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
1o6ozz56i8q0xgyl6xa41n2v7kelhli