menu menu_open
  • edit Edit

    Navigation

    • Main page
    • All pages
    • Recent changes
    • Random page
    • Help

    Tools

    • What links here
    • Related changes
    • Special pages
    • Printable version
    • Permanent link
    • Page information

    Variants

The Lab Rats 2 - Reformulate Wiki

Module:Formatted appearance

14 article Pages
18 photo Files
2128 edit Edits
22 person Users
timeline photo_library leaderboard file_upload
palette
  • computer
code
  • computer
pages api security app_shortcut
more_vertical
  • timeline Recent changes
  • photo_library New Files
  • leaderboard Statistics
  • file_upload Upload file
  • palette CSS expand_more
    • computer
  • code JS expand_more
    • computer
  • pages All pages
  • apisandbox API sandbox
  • security System messages
  • app_shortcut Special pages
grid_view double_arrow forum file_download extension file_upload visibility book category delete_sweep
settings
contrast

  • brightness_auto hdr_auto
  • brightness_7 brightness_1
  • brightness_6 brightness_2
  • brightness_5 brightness_3
  • brightness_4
  • brightness_3 brightness_5
  • brightness_2 brightness_6
  • brightness_1 brightness_7
hdr_auto
  • brightness_auto
  • hdr_auto
  • light_mode
  • dark_mode

  • palette
  • tonality

  • brightness_auto hdr_auto
  • gradient gradient
  • thermostat thermostat
  • ac_unit storm
  • Duo
  • Solo
format_paint
  • emergency deployed_code
  • emergency opacity
  • square
  • contrast

  • deployed_code build square contrast
  • 1
  • 2
  • 3
  • 4
palette
  • brightness_auto
  • hdr_auto
  • light_mode
  • dark_mode

  • build
  • emergency invert_colors_off
  • contrast
  • format_paint
  • android
  • colorize
colorize
  • brightness_auto
  • hdr_auto
  • bedtime_off
  • bedtime

  • build
  • square
  • computer
  • invert_colors
  • brush
  • filter_b_and_w
  • contrast
  • smart_toy
  • 1
  • 2
  • 3
  • 4
brush
  • A
  • B
  • C
  • D
  • E
  • F
  • G
  • H
  • Welcome to the Lab Rats 2 - Reformulate Wiki.
  • Stay tuned here for news and changes...
  • This wiki is currently being built. Feel free to contribute to it and discuss any suggestions or changes.
  • Visit the Lab Rats 2 Discord to discuss any missing information!
  • Module
  • Discussion
  • Read
  • View source
  • View history

Module:Formatted appearance

From The Lab Rats 2 - Reformulate Wiki
Revision as of 01:32, 28 December 2021 by Cooperdk (talk | contribs) (1 revision imported: Imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Formatted appearance/doc

-- This module requires the use of Module:List.
local list = require('Module:List')

local p = {}

-- Local function which is used to get a correctly formatted entry.
-- Function checks if the array had a value added by checking the counter,
-- and returns the relevant result.
local function getFormattedEntry(args, counter)
	if (counter == 1) then																				-- Check if the counter stayed the same.
		return ""																						-- Nothing was added to array; Return empty string.
	elseif (counter == 2) then																			-- Check if only one value was added to the array.
		return args[1]																					-- Only one value was added to array; Return that value.
	else																								-- The array had more than one value added.
		return list.makeList("unbulleted", args)														-- Call list.makeList() to retrieve the formatted plainlist.
	end
end

--[[
Local function which is used to format an appearance for a comic book,
in the style of:
	Line 1: <comic book title> #<issue number> (with comic book title in italics)
	Line 2: <release date>

For other usages, see createGenericEntry().

The function works with the following combinations:
	-- Only comic book title (example: "The Incredible Hulk").
	-- Title and issue number (example: "The Incredible Hulk" and "181").
	-- Title and release date (example: "The Incredible Hulk and "November 1974").
	-- Title, issue number and release date (example: "The Incredible Hulk", "181" and "November 1974").
	
	-- Only release date (example: "November 1974").
--]]
local function createComicEntry(appearanceMajor, appearanceMinor, appearanceDate)
	local fullString = {}																				-- Variable to save the array.
	local counter = 1																					-- Variable to save the array counter.
	
	if (appearanceMajor ~= nil) then																	-- Check if a comic book title was entered.

		if (appearanceMinor == nil) then																-- A comic book title was entered; Check if a issue number was entered.
			fullString[counter] = appearanceMajor 														-- A issue was not entered; Add only the comic book title to the array.
			counter = counter + 1																		-- Increment counter by one.
		else 
			fullString[counter] = appearanceMajor .. " " .. appearanceMinor								-- A issue was entered; Add both to the array.
			counter = counter + 1																		-- Increment counter by one.
		end
	end
	
	if (appearanceDate ~= nil) then																		-- Check if a release date was entered.
		fullString[counter] = appearanceDate															-- A release date was entered; Add it to the array.
		counter = counter + 1																			-- Increment counter by one.
	end

	return getFormattedEntry(fullString, counter)														-- Call getFormattedEntry() to get a correctly formatted entry.
end

--[[
Local function which is used to format an appearance for most usages,
including television, film, books, songs and games, in the style of:
	Line 1: <minor work title> (in quotes) (Minor works include: TV episodes, chapters, songs and game missions)
	Line 2: <major work title> (in italics) (Major works include: TV series, films, books, albums and games)
	Line 3: <release date>

For comic book usages, see createComicEntry().

The function works with the following combinations:
	-- Only minor work title (example: "Live Together, Die Alone").
	-- Minor work title and major work title (example: "Live Together, Die Alone" and "Lost").
	-- Minor work title and release date (example: "Live Together, Die Alone" and "May 24, 2006").
	-- Minor work title, major work title and release date (example: "Live Together, Die Alone", "Lost" and "May 24, 2006").
	
	-- Only major work title (example: "Lost").
	-- major work title and release date (example: "Lost" and "May 24, 2006").
	
	-- Only release date (example: "May 24, 2006").
--]]
local function createGenericEntry(appearanceMajor, appearanceMinor, appearanceDate)
	local fullString = {}																				-- Variable to save the array.
	local counter = 1																					-- Variable to save the array counter.
	
	if (appearanceMinor ~= nil) then																	-- Check if a minor appearance was entered.
		fullString[counter] = appearanceMinor															-- A minor appearance was entered; Add it to the array.
		counter = counter + 1																			-- Increment counter by one.
	end
	
	if (appearanceMajor ~= nil) then																	-- Check if a major appearance was entered.
		fullString[counter] = appearanceMajor															-- A major appearance was entered; Add it to the array.
		counter = counter + 1																			-- Increment counter by one.
	end
	
	if (appearanceDate ~= nil) then																		-- Check if a release date was entered.
		fullString[counter] = appearanceDate															-- A release date was entered; Add it to the array.
		counter = counter + 1																			-- Increment counter by one.
	end

	return getFormattedEntry(fullString, counter)														-- Call getFormattedEntry() to get a correctly formatted entry.
end

-- Local function which is used to format with a hash symbol comic book issues.
-- For other minor works, see getFormattedGenericMinorWork().
local function getFormattedComicMinorWorkTitle(issue)
	if (issue ~= nil) then																				-- Check if the issue is not nil.
		if (string.find(issue, "#")) then																-- Check if the issue already has a hash symbol.
			return issue																				-- Hash symbol already present; Return issue.
		else
			local formattedString = string.gsub(issue, "%d+", "#%1")									-- Hash symbol not found; Add the symbol before the issue number.
			return formattedString																		-- Return issue.
		end
	else
		return nil																						-- issue is nil; Return nil.
	end
end

-- Local function which is used to format with quotes a minor work title of most types.
-- For comic book issues, see getFormattedComicMinorWork() (see [MOS:MINORWORK]).
local function getFormattedGenericMinorWorkTitle(title)
	if (title ~= nil) then																				-- Check if the title is not nil.
		return "\"" .. title .. "\""																	-- Title is not nil; Add quotes to the title.
	else
		return nil																						-- Title is nil; Return nil.
	end
end

-- Local function which is used to format with italics a major work title (see [MOS:MAJORWORK]).
local function getFormattedMajorWorkTitle(title)
	if (title ~= nil) then																				-- Check if the title is not nil.
		return "''" .. title .. "''"																	-- Title is not nil; Add italics to the title.
	else
		return nil																						-- Title is nil; Return nil.
	end
end

-- Local function which does the actual main process.
local function _getFormattedAppearance(args)
	local appearanceMajor = args['major_work']															-- Get the title of the major work.
	local appearanceMinor = args['minor_work']															-- Get the title of the minor work.
	
	local isComic = false																				-- Variable to save the status of wether the appearence is from a comic book.
	if (args['issue'] ~= nil) then																		-- Check if the comic specific issue is not nil.					
		appearanceMinor = args['issue']																	-- Issue is not nil; Get the issue number.
		isComic = true																					-- Set isComic to true.
	end
	
	local appearanceDate = args['date']																	-- Get the release date of the minor work.
	
	local formattedAppearanceMajor = getFormattedMajorWorkTitle(appearanceMajor)						-- Call getFormattedMajorWorkTitle() to get a formatted major work title.

	if (isComic == false) then																			-- Check if the appearance is a comic book appearance.
																										-- The appearance is not a comic book appearance; 
		local formattedAppearanceMinor = getFormattedGenericMinorWorkTitle(appearanceMinor)				-- Call getFormattedGenericMinorWorkTitle() to get a formatted minor work title.
		return createGenericEntry(formattedAppearanceMajor, formattedAppearanceMinor, appearanceDate)	-- Call createGenericEntry() to create an appearance entry.
	else
																										-- The appearance is a comic book appearance. 
		local formattedAppearanceMinor = getFormattedComicMinorWorkTitle(appearanceMinor)				-- Call getFormattedComicMinorWorkTitle() to get a formatted minor work title.
		return createComicEntry(formattedAppearanceMajor, formattedAppearanceMinor, appearanceDate)		-- Call createComicEntry() to create a comic book appearance entry.
	end
end

--[[
Public function which is used to format the |first_appeared= and |last_appeared= fields.
The usage of this module allows for correct title formatting (see [MOS:MAJORWORK] and [MOS:MINORWORK]),
and correct line breaks based on guidelines (see [WP:UBLIST]).

Parameters:
	-- |major_work=		— optional; The title of the major work the fictional element appeared in.
										Major works include TV series, films, books, albums and games.
	-- |minor_work=		— optional; The title of the minor work the fictional element appeared in.
										Minor works include TV episodes, chapters, songs and game missions.
	-- |issue=			— optional; The number of the comic book issue the fictional element appeared in.
	-- |date=			— optional; The date of the publication/release of the minor work where the fictional element appeared in.
--]]
function p.getFormattedAppearance(frame)
	local getArgs = require('Module:Arguments').getArgs													-- Use Module:Arguments to access module arguments.
	local args = getArgs(frame)																			-- Get the arguments sent via the template.

	return _getFormattedAppearance(args)																-- Call _getFormattedAppearance() to perform the actual process.
end

return p
Retrieved from "https://lr2wiki.porn-organizer.org/index.php?title=Module:Formatted_appearance&oldid=1211"
  • Privacy policy
  • About The Lab Rats 2 - Reformulate Wiki
  • Disclaimers
    • This page was last edited on 28 December 2021, at 01:32.
    • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
    • Creative Commons Attribution-ShareAlike
    • Powered by MediaWiki

    timeline Recent changes
    arrow_forward_ios

    No changes during the given period match these criteria.

    info About The Lab Rats 2 - Reformulate Wiki
    edit

    The wiki for the adult sandbox game Lab Rabs 2 - Reformulate

    search saved_search
    search saved_search Search
    apps
    • live_help
    • hive
    • insert_link
    • timeline
    • visibility
    • shuffle
    • build
    • help
    • file_download
    • attachment
    public_off Not logged inReady
    widgets
    public StandardReady
    hive MirahezeReady
    Qora QoreReady
    • Privacy policy
    • About The Lab Rats 2 - Reformulate Wiki
    • Disclaimers
    insert_link timeline visibility shuffle build help file_download attachment
    account_circle
    • refresh

    • Create account
    • Log in
    refresh