Module:PageRef: Difference between revisionsGive feedback
m initial version that supports already localized hero names |
m get_file_name now uses alt_file_name optionally |
||
| Line 21: | Line 21: | ||
p.get_file_name = function(frame) | p.get_file_name = function(frame) | ||
local resource_name_localized = frame.args[1] | local resource_name_localized = frame.args[1] | ||
local alt_file_name = frame.args[2] | |||
--alt_file_name is optional; if not provided, assume resource_name_localized is correct | |||
if alt_file_name ~= nil then | |||
file_name = alt_file_name | |||
else | |||
--Determine the filename to use | |||
--Heroes use <hero_name>_MM.ext | |||
--Items use <item_name>.ext | |||
--Abilities use <ability_name>.ext | |||
if is_hero(resource_name_localized) then | |||
file_name = resource_name_localized .. "_MM" | |||
--elseif is_item(resource_name_localized) then | |||
--file_name = file_name .. "" | |||
--elseif is_ability(resource_name_localized) then | |||
--file_name = file_name .. "" | |||
end | |||
end | |||
-- Prefix with File namespace | -- Prefix with File namespace | ||
file_name = "File:" .. | file_name = "File:" .. file_name | ||
-- Try to grab SVG if possible | -- Try to grab SVG if possible | ||