Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Fiction redirect category handler/Franchise
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} --[[ Local function which adds the names relevant TV series to the args table. Franchise templates, such as the Arrowverse-specific one, have short parameters that editors can use instead of the full TV series name. This functions checks if the user-input parameters match the ones on the list, and if they do, adds them to the list. Franchise templates can also use a "franchise" default parameter so all members will automatically be tagged in the franchise category, as well as the specific TV series category. --]] local function getListOfSeriesTags(templateArgs, franchise, tvSeriesNameList, validArgs) local seriesArgs = {} for i, v in ipairs(tvSeriesNameList) do local tvSeries = tvSeriesNameList[i] -- Check if the user-input parameter matches one on the list; -- If it matches, add the series name to the list. if (templateArgs[tvSeries.argName]) then table.insert(seriesArgs, tvSeries.seriesName) table.insert(validArgs, tvSeries.argName) end end if (#seriesArgs > 0) then table.insert(seriesArgs, franchise) -- This parameter is used by the relevant "R to fictional x" templates -- to enable multi-series categories. seriesArgs["multi"] = "yes" templateArgs["multi_series_name_table"] = seriesArgs else templateArgs["series_name"] = franchise end return templateArgs, validArgs end --[[ Public function which handles the main operation. --]] function p.main(args, objectType, franchise, tvSeriesNameList) local validArgs = {"correct_disambiguation", "multi", "multi_series_name_table"} args, validArgs = getListOfSeriesTags(args, franchise, tvSeriesNameList, validArgs) -- Franchise articles, such as the Arrowverse and the Marvel Cinematic Universe, -- use the franchise name as disambiguation for articles, and not a TV series or film name. args["correct_disambiguation"] = franchise local fictionRedirectCategoryHandler = require('Module:Fiction redirect category handler') return fictionRedirectCategoryHandler["_" .. objectType](args, validArgs) end --[[ Public function which is used for the /testcases to verify correct series name output. --]] function p.testSeriesName(args, franchise, tvSeriesNameList) args = getListOfSeriesTags(args, franchise, tvSeriesNameList, {}) if (args.series_name) then return args.series_name else return args.multi_series_name_table[1] end end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Fiction-related redirects templates
(
edit
)
Template:Lua
(
edit
)
Module:Fiction redirect category handler/Franchise/doc
(
edit
)