Module:Definitions: Difference between revisions
From SpiritVale Wiki
More actions
No edit summary Tags: Mobile edit Mobile web edit |
No edit summary Tags: Mobile edit Mobile web edit |
||
| Line 148: | Line 148: | ||
opts = opts or {} | opts = opts or {} | ||
local noicon = truthy(opts.noicon) | local noicon = truthy(opts.noicon) | ||
local pill = truthy(opts.pill) | |||
local fill = truthy(opts.fill) | |||
local db = load_db() | local db = load_db() | ||
| Line 177: | Line 179: | ||
local miss_icon = noicon and "" or '<span class="sv-def-icon sv-def-icon--missing" aria-hidden="true">?</span>' | local miss_icon = noicon and "" or '<span class="sv-def-icon sv-def-icon--missing" aria-hidden="true">?</span>' | ||
return | return | ||
'<span class="sv-def sv-def--missing sv-def--' .. enc_attr(d_lc) .. '"' .. | '<span class="sv-def sv-def--missing' .. | ||
(pill and ' sv-def--pill' or '') .. | |||
(fill and ' sv-def--fill' or '') .. | |||
' sv-def--' .. enc_attr(d_lc) .. '"' .. | |||
' data-sv-def-domain="' .. enc_attr(domain) .. '"' .. | ' data-sv-def-domain="' .. enc_attr(domain) .. '"' .. | ||
' data-sv-def-key="' .. enc_attr(key) .. '"' .. | ' data-sv-def-key="' .. enc_attr(key) .. '"' .. | ||
(pill and ' data-sv-def-pill="1"' or '') .. | |||
(fill and ' data-sv-def-fill="1"' or '') .. | |||
'>' .. | '>' .. | ||
miss_icon .. | miss_icon .. | ||
| Line 189: | Line 196: | ||
if noicon then | if noicon then | ||
classes = classes .. ' sv-def--noicon' | classes = classes .. ' sv-def--noicon' | ||
end | |||
if pill then | |||
classes = classes .. ' sv-def--pill' | |||
end | |||
if fill then | |||
classes = classes .. ' sv-def--fill' | |||
end | end | ||
| Line 196: | Line 209: | ||
'data-sv-def-key="' .. enc_attr(key) .. '"', | 'data-sv-def-key="' .. enc_attr(key) .. '"', | ||
} | } | ||
if pill then | |||
attrs[#attrs + 1] = 'data-sv-def-pill="1"' | |||
end | |||
if fill then | |||
attrs[#attrs + 1] = 'data-sv-def-fill="1"' | |||
end | |||
-- Only include tooltip/link attributes when populated. | -- Only include tooltip/link attributes when populated. | ||
| Line 225: | Line 244: | ||
local key = a[2] or a.Key or a.key | local key = a[2] or a.Key or a.key | ||
local noicon = a.noicon or a.NoIcon or a[3] | local noicon = a.noicon or a.NoIcon or a[3] | ||
return render(domain, key, { noicon = noicon }) | local pill = a.pill or a.Pill | ||
local fill = a.fill or a.Fill | |||
return render(domain, key, { noicon = noicon, pill = pill, fill = fill }) | |||
end | end | ||