Module:Fiction redirect category handler/Franchise
| This module depends on the following other modules: |
Module:Fiction redirect category handler/Franchise is used handle the shared code used by franchise-specific module handlers, such as Module:Arrowverse redirect category handler.
Usage
local franchiseHandlerModule = require('Module:Fiction redirect category handler/Franchise')
return franchiseHandlerModule.main(objectType, frame, args, franchiseName, tvSeriesNameList)
require("strict")
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
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.