Module:Tt/Draft: Difference between revisions

Kuhlau (talk | contribs)
Created page with "local p = {} local lib = require('Module:Feature') function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { parentFirst = true, wrappers = { 'Template:Tt' } }) args[1] = args[1] or '<i>Missing text</i>' -- Return plain text if no tooltip given if lib.isEmpty(args[2]) then return args[1] end return p._main(args) end function p._main(args, options) local text = args[1] local tooltip = mw.text.decode(args[2], true) local out =..."
 
Kuhlau (talk | contribs)
No edit summary
Line 20: Line 20:
local text = args[1]
local text = args[1]
local tooltip = mw.text.decode(args[2], true)
local tooltip = mw.text.decode(args[2], true)
local header = lib.isNotEmpty(args.header) and mw.text.decode(args.header, true) or nil
local out = mw.html.create()
local out = mw.html.create()
Line 28: Line 29:
local base = tostring(p._main(args, {notoggle = true})) -- tt on label for hover as otherwise the <a> default title takes priority
local base = tostring(p._main(args, {notoggle = true})) -- tt on label for hover as otherwise the <a> default title takes priority
local linkTo = '[[' .. lib.ternary(link == '1', text, link) .. '|' .. base .. ']]'
local linkTo = '[[' .. lib.ternary(link == '1', text, link) .. '|' .. base .. ']]'
return p._main({ linkTo, args[2] }, {nohover = true}) -- external tt for collapsible for the separated clickable
return p._main({ linkTo, args[2], header = args.header }, {nohover = true}) -- external tt for collapsible for the separated clickable
end
end