Module:Television episode disambiguation description
Appearance
![]() | This module depends on the following other modules: |
Module:Television episode disambiguation creates an entry in a disambiguation page by converting a plain text episode article name into a correctly formatted link and its short description. The style of the links follows the guidelines at WP:NCTV, MOS:DABENTRY, MOS:ITALICTITLE and MOS:QUOTETITLE.
This module implements the {{Television episode disambiguation description}} template.
Usage
Parameter list
Parameter | Explanation | Status |
---|---|---|
name
|
The episode's full article name | required |
not_disambiguated
|
Set if the parentheses is part of the episode name | optional |
link_only
|
Set if you are only interested in getting a formatted article link | optional |
Examples
See also
-- Do not add a style which is not supported by the [[WP:NCTV]] guidelines.
local p = {}
function p.getFormmatedArticleLink(frame)
local articleName = frame.args[1] -- Get the article name.
local isParenthesesPartOfTitle = frame.args[2] -- Get the optional "yes"/"no" value.
local formattedLink -- Variable to save the formmated link.
if (isParenthesesPartOfTitle == "yes") then -- Check if the parentheses is part of the episode title.
formattedLink = "\"[[" .. articleName .. "]]\"" -- Add qutoation marks for the title per [[MOS:QUOTETITLE]].
else
local disambiguation = string.match(articleName, "%s%((.-)%)") -- Get the text inside the disambiguation parentheses.
local stylizedArticleName -- Variable to save new stylized article name.
if not disambiguation then -- Check if the article name does not have disambiguation parentheses.
stylizedArticleName = "\"" .. articleName .. "\"" -- Add qutoation marks for the title per [[MOS:QUOTETITLE]].
else -- Article has disambiguation.
local articleTitle = string.gsub(articleName, "%s+%b()$", "", 1, false) -- Get the article title without the disambiguation.
local stylizedArticleTitle = "\"" .. articleTitle .. "\"" -- Add qutoation marks to the title per [[MOS:QUOTETITLE]].
local isDisambiguationExtended = string.find(disambiguation, "episode") -- Check if the article name has extended disambiguation with the word "episode".
local stylizedDisambiguation -- Variable to save new stylized disambiguation.
if not isDisambiguationExtended then -- Article does not have extended disambiguation.
stylizedDisambiguation = "(''" .. disambiguation .. "'')" -- Add italics to the disambiguation which should only be the TV series name per [[MOS:ITALICTITLE]] and [[WP:NCTV]].
else -- Articles has extended disambiguation.
local tvSeries = string.gsub(disambiguation, "episode", "", 1, true) -- Get the TV series name without the extended disambiguation.
stylizedDisambiguation = "(''" .. tvSeries .. "'' episode)" -- Add italics to the disambiguation which should only be the TV series name per [[MOS:ITALICTITLE]] and [[WP:NCTV]];
end -- and add back the extended disambiguation.
stylizedArticleName = stylizedArticleTitle .. " " .. stylizedDisambiguation -- Recreate the article name from the title and disambiguation.
end
formattedLink = "[[" .. articleName .. "|" .. stylizedArticleName .. "]]" -- Create a pipped link.
end
return formattedLink -- Return the formmated link.
end
return p