Line 1: |
Line 1: |
− | local Utils = require("Module:Utils") | + | local _ = require("Module:Utils") |
| local Equipment = require('Module:Equipment') | | local Equipment = require('Module:Equipment') |
| | | |
| function getEquipment(frame) | | function getEquipment(frame) |
− | local args = Utils.getTemplateArgs(frame) | + | local args = _.getTemplateArgs(frame) |
| local name = args.explicit[1] or args.implicit.pagename or "" | | local name = args.explicit[1] or args.implicit.pagename or "" |
| return Equipment(name) | | return Equipment(name) |
| + | end |
| + | |
| + | function wikipediaLink(wikipedia) |
| + | if not wikipedia then |
| + | return |
| + | end |
| + | local parts = _.split(wikipedia, ":") |
| + | if parts[1] and parts[2] then |
| + | return string.format("[[wikipedia:%s:%s|%s]]", parts[1], parts[2], parts[2]) |
| + | else |
| + | return string.format("[[wikipedia:%s|%s]]", wikipedia, wikipedia) |
| + | end |
| end | | end |
| | | |
Line 13: |
Line 25: |
| end, | | end, |
| wikipedia = function(frame) | | wikipedia = function(frame) |
− | return getEquipment(frame):wikipedia() | + | return wikipediaLink(getEquipment(frame):wikipedia()) |
| end, | | end, |
| buildable = function(frame) | | buildable = function(frame) |