Line 11: |
Line 11: |
| args = args or getArgs{ frame = frame:getParent() } | | args = args or getArgs{ frame = frame:getParent() } |
| | | |
− | local name = args[1] or "??"
| |
− | local text = args.text
| |
− | local link = args.link
| |
− | local image = args.image
| |
− | local icon = args.icon
| |
− |
| |
− | local cards = {}
| |
− | for _, arg in ipairs(args) do
| |
− | table.insert(cards, arg == "-" and "<br />" or EquipmentCardKai:Asset({ arg, size = args.size }))
| |
− | end
| |
− |
| |
− | local formatted_link
| |
− | = image
| |
− | and EquipmentCardKai:Asset({ name, size = image, link = link or name })
| |
− | or F:format_link(link or name, text or name)
| |
− |
| |
− | local formatted_icon
| |
− | = icon
| |
− | -- [[Category:Todo]] again, would be nice to share Equipment object with EquipmentCardKai
| |
− | and F:format_image{ F:format_equipment_icon(Equipment(name):icon()) }
| |
− | or ""
| |
− |
| |
− | local tooltip_content = F:class_div("tooltip-contents", nil, #cards > 0 and table.concat(cards, "") or "??")
| |
− |
| |
− | return F:class_span("advanced-tooltip", nil, formatted_icon .. formatted_link .. tooltip_content)
| |
− |
| |
− | end
| |
− |
| |
− | function EquipmentLink.test(frame)
| |
− |
| |
− | local args = getArgs{ frame = frame:getParent() }
| |
− |
| |
| local name = args[1] or "??" | | local name = args[1] or "??" |
| local text = args.text | | local text = args.text |
Line 66: |
Line 34: |
| | | |
| local formatted_text | | local formatted_text |
− | = text
| + | |
− | and F:format_link(link or name, text or name)
| + | if text then |
− | or (icon | + | formatted_text = F:format_link(link or name, text or name) |
− | and F:format_link(link or name, text or name)
| + | else |
− | or "")
| + | if image then |
− | or (image | + | formatted_text = "" |
− | and "" | + | else |
− | or F:format_link(link or name, text or name)) | + | formatted_text = F:format_link(link or name, text or name) |
− | | + | end |
| + | end |
| | | |
| local tooltip_content = F:class_div("tooltip-contents", nil, #cards > 0 and table.concat(cards, "") or "??") | | local tooltip_content = F:class_div("tooltip-contents", nil, #cards > 0 and table.concat(cards, "") or "??") |