<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AFormatted_appearance</id>
	<title>Module:Formatted appearance - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://the-democratika.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AFormatted_appearance"/>
	<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Formatted_appearance&amp;action=history"/>
	<updated>2026-04-04T21:05:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://the-democratika.com/wiki/index.php?title=Module:Formatted_appearance&amp;diff=6891&amp;oldid=prev</id>
		<title>&gt;Gonnym: add require(&quot;strict&quot;); remove some spaces</title>
		<link rel="alternate" type="text/html" href="https://the-democratika.com/wiki/index.php?title=Module:Formatted_appearance&amp;diff=6891&amp;oldid=prev"/>
		<updated>2024-05-06T11:55:40Z</updated>

		<summary type="html">&lt;p&gt;add require(&amp;quot;strict&amp;quot;); remove some spaces&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require(&amp;quot;strict&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
-- This module requires the use of Module:List.&lt;br /&gt;
local list = require(&amp;quot;Module:List&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to get a correctly formatted entry.&lt;br /&gt;
-- Function checks if the array had a value added by checking the counter,&lt;br /&gt;
-- and returns the relevant result.&lt;br /&gt;
local function getFormattedEntry(args, counter)&lt;br /&gt;
	if (counter == 1) then														-- Check if the counter stayed the same.&lt;br /&gt;
		return &amp;quot;&amp;quot;																-- Nothing was added to array; Return empty string.&lt;br /&gt;
	elseif (counter == 2) then													-- Check if only one value was added to the array.&lt;br /&gt;
		return args[1]															-- Only one value was added to array; Return that value.&lt;br /&gt;
	else																		-- The array had more than one value added.&lt;br /&gt;
		return list.makeList(&amp;quot;unbulleted&amp;quot;, args)								-- Call list.makeList() to retrieve the formatted plainlist.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to format an appearance for a comic book,&lt;br /&gt;
in the style of:&lt;br /&gt;
	Line 1: &amp;lt;comic book title&amp;gt; #&amp;lt;issue number&amp;gt; (with comic book title in italics)&lt;br /&gt;
	Line 2: &amp;lt;release date&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other usages, see createGenericEntry().&lt;br /&gt;
&lt;br /&gt;
The function works with the following combinations:&lt;br /&gt;
	-- Only comic book title (example: &amp;quot;The Incredible Hulk&amp;quot;).&lt;br /&gt;
	-- Title and issue number (example: &amp;quot;The Incredible Hulk&amp;quot; and &amp;quot;181&amp;quot;).&lt;br /&gt;
	-- Title and release date (example: &amp;quot;The Incredible Hulk and &amp;quot;November 1974&amp;quot;).&lt;br /&gt;
	-- Title, issue number and release date (example: &amp;quot;The Incredible Hulk&amp;quot;, &amp;quot;181&amp;quot; and &amp;quot;November 1974&amp;quot;).&lt;br /&gt;
	&lt;br /&gt;
	-- Only release date (example: &amp;quot;November 1974&amp;quot;).&lt;br /&gt;
--]]&lt;br /&gt;
local function createComicEntry(appearanceMajor, appearanceMinor, appearanceDate)&lt;br /&gt;
	local fullString = {}														-- Variable to save the array.&lt;br /&gt;
	local counter = 1															-- Variable to save the array counter.&lt;br /&gt;
	&lt;br /&gt;
	if (appearanceMajor ~= nil) then											-- Check if a comic book title was entered.&lt;br /&gt;
&lt;br /&gt;
		if (appearanceMinor == nil) then										-- A comic book title was entered; Check if a issue number was entered.&lt;br /&gt;
			fullString[counter] = appearanceMajor 								-- A issue was not entered; Add only the comic book title to the array.&lt;br /&gt;
			counter = counter + 1												-- Increment counter by one.&lt;br /&gt;
		else &lt;br /&gt;
			fullString[counter] = appearanceMajor .. &amp;quot; &amp;quot; .. appearanceMinor		-- A issue was entered; Add both to the array.&lt;br /&gt;
			counter = counter + 1												-- Increment counter by one.&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if (appearanceDate ~= nil) then												-- Check if a release date was entered.&lt;br /&gt;
		fullString[counter] = appearanceDate									-- A release date was entered; Add it to the array.&lt;br /&gt;
		counter = counter + 1													-- Increment counter by one.&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return getFormattedEntry(fullString, counter)								-- Call getFormattedEntry() to get a correctly formatted entry.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to format an appearance for most usages,&lt;br /&gt;
including television, film, books, songs and games, in the style of:&lt;br /&gt;
	Line 1: &amp;lt;minor work title&amp;gt; (in quotes) (Minor works include: TV episodes, chapters, songs and game missions)&lt;br /&gt;
	Line 2: &amp;lt;major work title&amp;gt; (in italics) (Major works include: TV series, films, books, albums and games)&lt;br /&gt;
	Line 3: &amp;lt;release date&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For comic book usages, see createComicEntry().&lt;br /&gt;
&lt;br /&gt;
The function works with the following combinations:&lt;br /&gt;
	-- Only minor work title (example: &amp;quot;Live Together, Die Alone&amp;quot;).&lt;br /&gt;
	-- Minor work title and major work title (example: &amp;quot;Live Together, Die Alone&amp;quot; and &amp;quot;Lost&amp;quot;).&lt;br /&gt;
	-- Minor work title and release date (example: &amp;quot;Live Together, Die Alone&amp;quot; and &amp;quot;May 24, 2006&amp;quot;).&lt;br /&gt;
	-- Minor work title, major work title and release date (example: &amp;quot;Live Together, Die Alone&amp;quot;, &amp;quot;Lost&amp;quot; and &amp;quot;May 24, 2006&amp;quot;).&lt;br /&gt;
	&lt;br /&gt;
	-- Only major work title (example: &amp;quot;Lost&amp;quot;).&lt;br /&gt;
	-- major work title and release date (example: &amp;quot;Lost&amp;quot; and &amp;quot;May 24, 2006&amp;quot;).&lt;br /&gt;
	&lt;br /&gt;
	-- Only release date (example: &amp;quot;May 24, 2006&amp;quot;).&lt;br /&gt;
--]]&lt;br /&gt;
local function createGenericEntry(appearanceMajor, appearanceMinor, appearanceDate)&lt;br /&gt;
	local fullString = {}														-- Variable to save the array.&lt;br /&gt;
	local counter = 1															-- Variable to save the array counter.&lt;br /&gt;
	&lt;br /&gt;
	if (appearanceMinor ~= nil) then											-- Check if a minor appearance was entered.&lt;br /&gt;
		fullString[counter] = appearanceMinor									-- A minor appearance was entered; Add it to the array.&lt;br /&gt;
		counter = counter + 1													-- Increment counter by one.&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if (appearanceMajor ~= nil) then											-- Check if a major appearance was entered.&lt;br /&gt;
		fullString[counter] = appearanceMajor									-- A major appearance was entered; Add it to the array.&lt;br /&gt;
		counter = counter + 1													-- Increment counter by one.&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if (appearanceDate ~= nil) then												-- Check if a release date was entered.&lt;br /&gt;
		fullString[counter] = appearanceDate									-- A release date was entered; Add it to the array.&lt;br /&gt;
		counter = counter + 1													-- Increment counter by one.&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return getFormattedEntry(fullString, counter)								-- Call getFormattedEntry() to get a correctly formatted entry.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to format with a hash symbol comic book issues.&lt;br /&gt;
-- For other minor works, see getFormattedGenericMinorWork().&lt;br /&gt;
local function getFormattedComicMinorWorkTitle(issue)&lt;br /&gt;
	if (issue ~= nil) then														-- Check if the issue is not nil.&lt;br /&gt;
		if (string.find(issue, &amp;quot;#&amp;quot;)) then										-- Check if the issue already has a hash symbol.&lt;br /&gt;
			return issue														-- Hash symbol already present; Return issue.&lt;br /&gt;
		else&lt;br /&gt;
			local formattedString = string.gsub(issue, &amp;quot;%d+&amp;quot;, &amp;quot;#%1&amp;quot;)			-- Hash symbol not found; Add the symbol before the issue number.&lt;br /&gt;
			return formattedString												-- Return issue.&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return nil																-- issue is nil; Return nil.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to format with quotes a minor work title of most types.&lt;br /&gt;
-- For comic book issues, see getFormattedComicMinorWork() (see [MOS:MINORWORK]).&lt;br /&gt;
local function getFormattedGenericMinorWorkTitle(title)&lt;br /&gt;
	if (title ~= nil) then														-- Check if the title is not nil.&lt;br /&gt;
		return &amp;quot;\&amp;quot;&amp;quot; .. title .. &amp;quot;\&amp;quot;&amp;quot;											-- Title is not nil; Add quotes to the title.&lt;br /&gt;
	else&lt;br /&gt;
		return nil																-- Title is nil; Return nil.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to format with italics a major work title (see [MOS:MAJORWORK]).&lt;br /&gt;
local function getFormattedMajorWorkTitle(title)&lt;br /&gt;
	if (title ~= nil) then														-- Check if the title is not nil.&lt;br /&gt;
		return &amp;quot;&amp;#039;&amp;#039;&amp;quot; .. title .. &amp;quot;&amp;#039;&amp;#039;&amp;quot;											-- Title is not nil; Add italics to the title.&lt;br /&gt;
	else&lt;br /&gt;
		return nil																-- Title is nil; Return nil.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which does the actual main process.&lt;br /&gt;
local function _getFormattedAppearance(args)&lt;br /&gt;
	local appearanceMajor = args.major_work										-- Get the title of the major work.&lt;br /&gt;
	local appearanceMinor = args.minor_work										-- Get the title of the minor work.&lt;br /&gt;
	&lt;br /&gt;
	local isComic = false														-- Variable to save the status of wether the appearence is from a comic book.&lt;br /&gt;
	if (args.issue ~= nil) then													-- Check if the comic specific issue is not nil.					&lt;br /&gt;
		appearanceMinor = args.issue											-- Issue is not nil; Get the issue number.&lt;br /&gt;
		isComic = true															-- Set isComic to true.&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local appearanceDate = args.date											-- Get the release date of the minor work.&lt;br /&gt;
	&lt;br /&gt;
	local formattedAppearanceMajor = getFormattedMajorWorkTitle(appearanceMajor)						-- Call getFormattedMajorWorkTitle() to get a formatted major work title.&lt;br /&gt;
&lt;br /&gt;
	if (isComic == false) then																			-- Check if the appearance is a comic book appearance.&lt;br /&gt;
																										-- The appearance is not a comic book appearance; &lt;br /&gt;
		local formattedAppearanceMinor = getFormattedGenericMinorWorkTitle(appearanceMinor)				-- Call getFormattedGenericMinorWorkTitle() to get a formatted minor work title.&lt;br /&gt;
		return createGenericEntry(formattedAppearanceMajor, formattedAppearanceMinor, appearanceDate)	-- Call createGenericEntry() to create an appearance entry.&lt;br /&gt;
	else&lt;br /&gt;
																										-- The appearance is a comic book appearance. &lt;br /&gt;
		local formattedAppearanceMinor = getFormattedComicMinorWorkTitle(appearanceMinor)				-- Call getFormattedComicMinorWorkTitle() to get a formatted minor work title.&lt;br /&gt;
		return createComicEntry(formattedAppearanceMajor, formattedAppearanceMinor, appearanceDate)		-- Call createComicEntry() to create a comic book appearance entry.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to format the |first_appeared= and |last_appeared= fields.&lt;br /&gt;
The usage of this module allows for correct title formatting (see [MOS:MAJORWORK] and [MOS:MINORWORK]),&lt;br /&gt;
and correct line breaks based on guidelines (see [WP:UBLIST]).&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
	-- |major_work=		— optional; The title of the major work the fictional element appeared in.&lt;br /&gt;
										Major works include TV series, films, books, albums and games.&lt;br /&gt;
	-- |minor_work=		— optional; The title of the minor work the fictional element appeared in.&lt;br /&gt;
										Minor works include TV episodes, chapters, songs and game missions.&lt;br /&gt;
	-- |issue=			— optional; The number of the comic book issue the fictional element appeared in.&lt;br /&gt;
	-- |date=			— optional; The date of the publication/release of the minor work where the fictional element appeared in.&lt;br /&gt;
--]]&lt;br /&gt;
function p.getFormattedAppearance(frame)&lt;br /&gt;
	local getArgs = require(&amp;quot;Module:Arguments&amp;quot;).getArgs							-- Use Module:Arguments to access module arguments.&lt;br /&gt;
	local args = getArgs(frame)													-- Get the arguments sent via the template.&lt;br /&gt;
&lt;br /&gt;
	return _getFormattedAppearance(args)										-- Call _getFormattedAppearance() to perform the actual process.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>&gt;Gonnym</name></author>
	</entry>
</feed>