FANDOM


local p = {}
local StaffNames = mw.loadData('Module:StaffCorrection/data')
local h = require("Module:HF")
 
function p.lua_get_corrected_name(name)
    local output = ''
 
    if not h.isempty(name)
        then output = StaffNames[ string.lower( mw.text.trim(name) ) ] or mw.text.trim(name)
    end
 
    return output
end
 
 
function p.get_corrected_name(frame)
    return p.lua_get_corrected_name(frame.args[1])
end
 
 
function p.lua_get_staff_link_and_category(name, subcategory)
    local corrected_name = ''
    local s = ''
    local category = ''
    local output = ''
 
    if not h.isempty(name)
        then
            name = mw.text.trim(name)
            name = h.lua_breaklink(name, 1)
            s = string.lower(name)
            if h.inlist( {'uncredited', 'n/a'}, s )
                then output = 'Uncredited'
                else
                    corrected_name = p.lua_get_corrected_name(name)
                    output = h.Link(corrected_name, name)
                    if not h.isempty(subcategory)
                        then category = corrected_name..'/'..subcategory
                    end
            end
    end
 
    return output, category
end
 
 
function p.lua_get_creators(list)
    local i
    local link
    local category
    local links = ''
    local categories = ''
 
    if not h.isempty(list)
        then
            links = {}
            categories = {}
            list = mw.text.split(list, ';')
            for i = 1, #list do
                link, category = p.lua_get_staff_link_and_category(list[i], 'Creator')
                table.insert(links, link)
                table.insert(categories, category)
            end
            links = mw.text.listToText(links, ', ', ', ')
    end
 
    return links, categories
end
 
 
function p.get_creators(frame)
    local getArgs = require('Dev:Arguments').getArgs
    local args = getArgs (frame)
    local list = args[1]
    local links
    local categories
 
    links, categories = p.lua_get_creators(list)
    return links..h.lua_create_list_of_categories(categories)
end
 
 
return p
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+