<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ARef</id>
	<title>Module:Ref - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ARef"/>
	<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:Ref&amp;action=history"/>
	<updated>2026-04-07T16:26:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://mbwiki.stairwaygames.work/w/index.php?title=Module:Ref&amp;diff=5705&amp;oldid=prev</id>
		<title>Admin coral island: Created page with &quot;-- &lt;nowiki&gt; local ref = {} local getArgs = require(&#039;Dev:Arguments&#039;).getArgs local lang = mw.language.getContentLanguage()  --sourcedata used for autofill functions ref.sourcedata = {}  --[[--------------------------&lt; A U T O F I L L  D A T A &gt;-------------------------------------------------  looks for a module containing data that autofills a reference, aby finding its entry on a table using a shorthand  for example, &quot;|game=FFVII&quot; to autofill a reference for &quot;Final Fant...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:Ref&amp;diff=5705&amp;oldid=prev"/>
		<updated>2023-08-04T03:11:02Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- &amp;lt;nowiki&amp;gt; local ref = {} local getArgs = require(&amp;#039;Dev:Arguments&amp;#039;).getArgs local lang = mw.language.getContentLanguage()  --sourcedata used for autofill functions ref.sourcedata = {}  --[[--------------------------&amp;lt; A U T O F I L L  D A T A &amp;gt;-------------------------------------------------  looks for a module containing data that autofills a reference, aby finding its entry on a table using a shorthand  for example, &amp;quot;|game=FFVII&amp;quot; to autofill a reference for &amp;quot;Final Fant...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- &amp;lt;nowiki&amp;gt;&lt;br /&gt;
local ref = {}&lt;br /&gt;
local getArgs = require(&amp;#039;Dev:Arguments&amp;#039;).getArgs&lt;br /&gt;
local lang = mw.language.getContentLanguage()&lt;br /&gt;
&lt;br /&gt;
--sourcedata used for autofill functions&lt;br /&gt;
ref.sourcedata = {}&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A U T O F I L L  D A T A &amp;gt;-------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
looks for a module containing data that autofills a reference, aby finding its entry on a table using a shorthand&lt;br /&gt;
&lt;br /&gt;
for example, &amp;quot;|game=FFVII&amp;quot; to autofill a reference for &amp;quot;Final Fantasy VII&amp;quot; based on a module containing as much&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
--helper function for all to allow for recursion&lt;br /&gt;
local function recover(data, default_source, alternate_source, category, new, author_type)&lt;br /&gt;
	local target = new or category&lt;br /&gt;
	&lt;br /&gt;
	--use the currently selected version by default; if it has nothing, use the base case&lt;br /&gt;
	local source = default_source[category] or alternate_source[category]&lt;br /&gt;
	&lt;br /&gt;
	--if the data is an author table, split to first[n]= and last[n]=&lt;br /&gt;
    if type(source) == &amp;#039;table&amp;#039; then&lt;br /&gt;
        if target == &amp;#039;author&amp;#039; and author_type ~= &amp;#039;developer&amp;#039; then&lt;br /&gt;
        	if type(source[1]) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		        for i, y in ipairs(source) do&lt;br /&gt;
		            data[&amp;#039;first&amp;#039; .. i] = source[i][1]&lt;br /&gt;
		            data[&amp;#039;last&amp;#039; .. i] = source[i][2]&lt;br /&gt;
		        end&lt;br /&gt;
	            if (author_type) then&lt;br /&gt;
	            	data[&amp;#039;author-type&amp;#039;] = author_type&lt;br /&gt;
	            end&lt;br /&gt;
	        else&lt;br /&gt;
	            data.first = source[1]&lt;br /&gt;
    	        data.last = source[2]&lt;br /&gt;
	            if (author_type) then&lt;br /&gt;
	            	data[&amp;#039;author-type&amp;#039;] = author_type&lt;br /&gt;
	            end&lt;br /&gt;
            end&lt;br /&gt;
    	else&lt;br /&gt;
    		--if it is a table, split to target[n]&lt;br /&gt;
	        for i, y in ipairs(source) do&lt;br /&gt;
	            data[target .. i] = y&lt;br /&gt;
	        end&lt;br /&gt;
	    end&lt;br /&gt;
    else&lt;br /&gt;
    	--if no table was found, assign as desired&lt;br /&gt;
    	data[target] = source&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function gameRef(data, game, game_version)&lt;br /&gt;
    recover(data, game_version, game, &amp;#039;developer&amp;#039;, &amp;#039;author&amp;#039;, &amp;#039;developer&amp;#039;)&lt;br /&gt;
    recover(data, game_version, game, &amp;#039;year&amp;#039;)&lt;br /&gt;
    recover(data, game_version, game, &amp;#039;month&amp;#039;)&lt;br /&gt;
    recover(data, game_version, game, &amp;#039;day&amp;#039;)&lt;br /&gt;
    data[&amp;#039;link&amp;#039;] = game_version[&amp;#039;link&amp;#039;] or game[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = game_version[&amp;#039;title&amp;#039;] or game[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;media&amp;#039;] = &amp;#039;game&amp;#039;&lt;br /&gt;
    data[&amp;#039;publisher&amp;#039;]  = game_version[&amp;#039;publisher&amp;#039;] or game[&amp;#039;publisher&amp;#039;]&lt;br /&gt;
    recover(data, game_version, game, &amp;#039;platform&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Automatically creates a reference for movies based on shorthand data module&lt;br /&gt;
local function movieRef(data, movie, movie_version)&lt;br /&gt;
    recover(data, movie_version, movie, &amp;#039;director&amp;#039;, &amp;#039;author&amp;#039;)&lt;br /&gt;
	data[&amp;#039;author-type&amp;#039;] = &amp;#039;Director&amp;#039;&lt;br /&gt;
    recover(data, movie_version, movie, &amp;#039;year&amp;#039;)&lt;br /&gt;
    recover(data, movie_version, movie, &amp;#039;month&amp;#039;)&lt;br /&gt;
    recover(data, movie_version, movie, &amp;#039;day&amp;#039;)&lt;br /&gt;
    data[&amp;#039;link&amp;#039;] = movie[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = movie[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = movie_version[&amp;#039;title&amp;#039;] or movie[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;media&amp;#039;] = &amp;#039;film&amp;#039;&lt;br /&gt;
    data[&amp;#039;publisher&amp;#039;] = movie_version[&amp;#039;studio&amp;#039;] or movie[&amp;#039;studio&amp;#039;]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Automatically creates a reference for series based on shorthand data module&lt;br /&gt;
local function seriesRef(data, series)&lt;br /&gt;
    recover(data, series, series, &amp;#039;executive&amp;#039;, &amp;#039;author&amp;#039;, &amp;#039;Executive Producer&amp;#039;)&lt;br /&gt;
    recover(data, series, series, &amp;#039;year&amp;#039;)&lt;br /&gt;
    data[&amp;#039;link&amp;#039;] = series[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = series[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;media&amp;#039;] = &amp;#039;series&amp;#039;&lt;br /&gt;
    data[&amp;#039;publisher&amp;#039;] = series[&amp;#039;studio&amp;#039;]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Automatically creates a reference for episode based on shorthand data module&lt;br /&gt;
local function episodeRef(data, episode, series)&lt;br /&gt;
    recover(data, episode, episode, &amp;#039;writer&amp;#039;, &amp;#039;author&amp;#039;, &amp;#039;Writer&amp;#039;)&lt;br /&gt;
    recover(data, episode, episode, &amp;#039;director&amp;#039;, &amp;#039;author&amp;#039;, &amp;#039;Director&amp;#039;)&lt;br /&gt;
    recover(data, episode, episode, &amp;#039;writerdirector&amp;#039;, &amp;#039;author&amp;#039;, &amp;#039;Writer &amp;amp; Director&amp;#039;)&lt;br /&gt;
    recover(data, episode, episode, &amp;#039;year&amp;#039;)&lt;br /&gt;
    recover(data, episode, episode, &amp;#039;month&amp;#039;)&lt;br /&gt;
    recover(data, episode, episode, &amp;#039;day&amp;#039;)&lt;br /&gt;
    data[&amp;#039;entry-link&amp;#039;] = episode[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;entry&amp;#039;] = episode[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;link&amp;#039;] = series[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = series[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;media&amp;#039;] = &amp;#039;episode&amp;#039;&lt;br /&gt;
    data[&amp;#039;number&amp;#039;] = episode[&amp;#039;number&amp;#039;]&lt;br /&gt;
    data[&amp;#039;season&amp;#039;] = episode[&amp;#039;season&amp;#039;]&lt;br /&gt;
    data[&amp;#039;publisher&amp;#039;] = episode[&amp;#039;studio&amp;#039;]&lt;br /&gt;
    data[&amp;#039;showfulldate&amp;#039;] = true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Automatically creates a reference for books or manga based on shorthand data module&lt;br /&gt;
--Can also be used with a guide or design bible for a game&lt;br /&gt;
local function bookRef(data, book)&lt;br /&gt;
    recover(data, book, book, &amp;#039;author&amp;#039;)&lt;br /&gt;
    recover(data, book, book, &amp;#039;year&amp;#039;)&lt;br /&gt;
    recover(data, book, book, &amp;#039;month&amp;#039;)&lt;br /&gt;
    recover(data, book, book, &amp;#039;day&amp;#039;)&lt;br /&gt;
    data[&amp;#039;link&amp;#039;] = book[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = book[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;media&amp;#039;] = &amp;#039;book&amp;#039;&lt;br /&gt;
    data[&amp;#039;additional-authors&amp;#039;] = book[&amp;#039;additional-authors&amp;#039;]&lt;br /&gt;
    data[&amp;#039;publisher&amp;#039;] = book[&amp;#039;publisher&amp;#039;]&lt;br /&gt;
    data[&amp;#039;isbn&amp;#039;] = book[&amp;#039;isbn&amp;#039;]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Automatically creates a reference for an album based on shorthand data module&lt;br /&gt;
local function albumRef(data, album, album_version)&lt;br /&gt;
    recover(data, album_version, album, &amp;#039;artist&amp;#039;, &amp;#039;author&amp;#039;)&lt;br /&gt;
    recover(data, album_version, album, &amp;#039;year&amp;#039;)&lt;br /&gt;
    recover(data, album_version, album, &amp;#039;month&amp;#039;)&lt;br /&gt;
    recover(data, album_version, album, &amp;#039;day&amp;#039;)&lt;br /&gt;
    data[&amp;#039;link&amp;#039;] = album[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = album[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = album_version[&amp;#039;title&amp;#039;] or album[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;media&amp;#039;] = &amp;#039;album&amp;#039;&lt;br /&gt;
    data[&amp;#039;publisher&amp;#039;] = album_version[&amp;#039;label&amp;#039;]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Automatically creates a reference for an album based on shorthand data module&lt;br /&gt;
local function songRef(data, song, song_version)&lt;br /&gt;
    recover(data, song_version, song, &amp;#039;artist&amp;#039;, &amp;#039;author&amp;#039;)&lt;br /&gt;
    recover(data, song_version, song, &amp;#039;year&amp;#039;)&lt;br /&gt;
    recover(data, song_version, song, &amp;#039;month&amp;#039;)&lt;br /&gt;
    recover(data, song_version, song, &amp;#039;day&amp;#039;)&lt;br /&gt;
    data[&amp;#039;entry-link&amp;#039;] = song[&amp;#039;link&amp;#039;]&lt;br /&gt;
    data[&amp;#039;entry&amp;#039;] = song_version[&amp;#039;title&amp;#039;] or song[&amp;#039;title&amp;#039;]&lt;br /&gt;
    data[&amp;#039;title&amp;#039;] = song_version[&amp;#039;album&amp;#039;] or song[&amp;#039;album&amp;#039;]&lt;br /&gt;
    data[&amp;#039;additional-authors&amp;#039;] = song_version[&amp;#039;featured&amp;#039;]&lt;br /&gt;
    data[&amp;#039;media&amp;#039;] = &amp;#039;song&amp;#039;&lt;br /&gt;
    data[&amp;#039;publisher&amp;#039;] = song_version[&amp;#039;label&amp;#039;]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H E L P E R  F U N C T I O N S &amp;gt;-------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
helper functions for parts of the reference, applies to all formats&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
--Assistant to generate the id&lt;br /&gt;
local function makeId(data)&lt;br /&gt;
	local id = &amp;#039;&amp;#039;&lt;br /&gt;
    if data[&amp;#039;id&amp;#039;] then&lt;br /&gt;
    	id = data[&amp;#039;id&amp;#039;]&lt;br /&gt;
    else&lt;br /&gt;
    	--first half of concatenated id, either author or publisher&lt;br /&gt;
    	local authorid = &amp;#039;&amp;#039;&lt;br /&gt;
    	if data[&amp;#039;last&amp;#039;] then authorid = data[&amp;#039;last&amp;#039;]&lt;br /&gt;
		elseif data[&amp;#039;last1&amp;#039;] then&lt;br /&gt;
			for n = 1, 10, 1 do&lt;br /&gt;
				if data[&amp;#039;last&amp;#039; .. n] then&lt;br /&gt;
					authorid = authorid .. data[&amp;#039;last&amp;#039; .. n]&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
    	elseif data[&amp;#039;author&amp;#039;] or data[&amp;#039;author1&amp;#039;] or data[&amp;#039;publisher&amp;#039;] then&lt;br /&gt;
    		if data[&amp;#039;author&amp;#039;] then authorid = data[&amp;#039;author&amp;#039;]&lt;br /&gt;
    		elseif data[&amp;#039;author1&amp;#039;] then authorid = data[&amp;#039;author1&amp;#039;]&lt;br /&gt;
    		elseif data[&amp;#039;publisher&amp;#039;] then authorid = data[&amp;#039;publisher&amp;#039;] end&lt;br /&gt;
&lt;br /&gt;
			authorid = authorid:gsub(&amp;#039;%[%[(.-)%]%]&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
            authorid = authorid:gsub(&amp;#039;%s+&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
            authorid = authorid:match(&amp;quot;%|(.*)&amp;quot;) or authorid&lt;br /&gt;
    	end&lt;br /&gt;
    	&lt;br /&gt;
    	--last half of concatenated id, either year or nothing&lt;br /&gt;
    	year = &amp;#039;&amp;#039;&lt;br /&gt;
    	if data[&amp;#039;year&amp;#039;] then&lt;br /&gt;
    		year = data[&amp;#039;year&amp;#039;]&lt;br /&gt;
    	elseif data[&amp;#039;year1&amp;#039;] then&lt;br /&gt;
    		year = data[&amp;#039;year1&amp;#039;]&lt;br /&gt;
    	end&lt;br /&gt;
    	&lt;br /&gt;
    	id = string.format(&amp;#039;%s%s&amp;#039;, authorid, year)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Assistant for dates&lt;br /&gt;
local function formatDates(data)&lt;br /&gt;
	local dates = &amp;#039;&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	--up to 10 dates&lt;br /&gt;
	for n = 0, 10, 1 do&lt;br /&gt;
		local m&lt;br /&gt;
		if n == 0 then m = &amp;#039;&amp;#039; else m = n end&lt;br /&gt;
		local to_append = &amp;#039;&amp;#039;&lt;br /&gt;
		&lt;br /&gt;
		--different output depending on chosen date format; defaults to just the year&lt;br /&gt;
		if data[&amp;#039;month&amp;#039;..m] and data[&amp;#039;showmonth&amp;#039;] then&lt;br /&gt;
			to_append = lang:formatDate(&amp;#039;Y, F&amp;#039;, data[&amp;#039;year&amp;#039;..m] .. &amp;#039;-&amp;#039; .. data[&amp;#039;month&amp;#039;..m])&lt;br /&gt;
		elseif data[&amp;#039;day&amp;#039;..m] and data[&amp;#039;showfulldate&amp;#039;] then&lt;br /&gt;
			to_append = lang:formatDate(&amp;#039;Y, F j&amp;#039;, data[&amp;#039;year&amp;#039;..m] .. &amp;#039;-&amp;#039; .. data[&amp;#039;month&amp;#039;..m] .. &amp;#039;-&amp;#039; .. data[&amp;#039;day&amp;#039;..m])&lt;br /&gt;
		elseif data[&amp;#039;dateformat&amp;#039;] then&lt;br /&gt;
			to_append = lang:formatDate(data[&amp;#039;dateformat&amp;#039;], data[&amp;#039;year&amp;#039;..m] .. &amp;#039;-&amp;#039; .. data[&amp;#039;month&amp;#039;..m] .. &amp;#039;-&amp;#039; .. data[&amp;#039;day&amp;#039;..m])&lt;br /&gt;
		else&lt;br /&gt;
			to_append = data[&amp;#039;year&amp;#039;..m] or &amp;#039;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if not (dates == &amp;#039;&amp;#039;) and not (to_append == &amp;#039;&amp;#039;) then dates = dates .. &amp;#039;; &amp;#039; end&lt;br /&gt;
		dates = dates .. to_append&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return dates&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Assistant for author section&lt;br /&gt;
local function formatAuthors(data)&lt;br /&gt;
	local authors = &amp;#039;&amp;#039;&lt;br /&gt;
	--up to 10 authors&lt;br /&gt;
	for n = 0, 10, 1 do&lt;br /&gt;
		local m&lt;br /&gt;
		if n == 0 then m = &amp;#039;&amp;#039; else m = n end&lt;br /&gt;
		local to_append = &amp;#039;&amp;#039;&lt;br /&gt;
		local separator = &amp;#039;,&amp;#039;&lt;br /&gt;
&lt;br /&gt;
		--either the first/last name of a person author, or name of the authoring group/organization&lt;br /&gt;
		if data[&amp;#039;last&amp;#039;..m] then&lt;br /&gt;
    		to_append = string.format(&amp;#039;%s, %s&amp;#039;, data[&amp;#039;last&amp;#039;..m], data[&amp;#039;first&amp;#039;..m])&lt;br /&gt;
    		separator = &amp;#039;;&amp;#039;&lt;br /&gt;
    		if data[&amp;#039;author-link&amp;#039;..m] then&lt;br /&gt;
    			to_append = string.format(&amp;#039;[[%s|%s]]&amp;#039;, data[&amp;#039;author-link&amp;#039;..m], to_append)&lt;br /&gt;
    		end&lt;br /&gt;
    	elseif data[&amp;#039;author&amp;#039;..m] then&lt;br /&gt;
    		to_append = data[&amp;#039;author&amp;#039;..m]&lt;br /&gt;
    		if data[&amp;#039;author-link&amp;#039;..m] then&lt;br /&gt;
    			to_append = string.format(&amp;#039;[[%s|%s]]&amp;#039;, data[&amp;#039;author-link&amp;#039;..m], to_append)&lt;br /&gt;
    		end&lt;br /&gt;
    	end&lt;br /&gt;
    		&lt;br /&gt;
    	--the type of each author, if applicable; if all authors are the same type, &amp;#039;author-type&amp;#039; applies&lt;br /&gt;
        if n &amp;gt; 0 and data[&amp;#039;author-type&amp;#039;..m] then&lt;br /&gt;
        	to_append = to_append .. &amp;#039; (&amp;#039; .. (data[&amp;#039;author-type&amp;#039;..m]:gsub(&amp;#039;^%l&amp;#039;, string.upper)) .. &amp;#039;)&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
    	&lt;br /&gt;
		if not (authors == &amp;#039;&amp;#039;) and not (to_append == &amp;#039;&amp;#039;) then authors = authors .. separator .. &amp;#039; &amp;#039; end&lt;br /&gt;
		authors = authors .. to_append&lt;br /&gt;
	end&lt;br /&gt;
    &lt;br /&gt;
    --if referencing a tweet, add handle; a tweet can only have one author	&lt;br /&gt;
    if data[&amp;#039;author-id&amp;#039;] and data[&amp;#039;tweet-id&amp;#039;] then&lt;br /&gt;
    	twitter_user = data[&amp;#039;author-id&amp;#039;]&lt;br /&gt;
    	authors = authors .. string.format(&lt;br /&gt;
    		&amp;#039; \[[https://www.twitter.com/%s @%s]\]&amp;#039;,&lt;br /&gt;
    		twitter_user, twitter_user)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    --if referencing youtube, add channel name; applies to all authors &lt;br /&gt;
    if data[&amp;#039;channel&amp;#039;] or data[&amp;#039;author-id&amp;#039;] and data[&amp;#039;youtube-id&amp;#039;] then&lt;br /&gt;
    	channel = data[&amp;#039;channel&amp;#039;] or data[&amp;#039;author-id&amp;#039;]&lt;br /&gt;
        authors = authors .. string.format(&lt;br /&gt;
        	&amp;#039; \[[https://www.youtube.com/@%s @%s]\]&amp;#039;,&lt;br /&gt;
        	channel, channel)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    --if referencing instagram, add account name; applies to all authors &lt;br /&gt;
    if data[&amp;#039;author-id&amp;#039;] and data[&amp;#039;instagram-id&amp;#039;] then&lt;br /&gt;
    	instagram_user = data[&amp;#039;author-id&amp;#039;]&lt;br /&gt;
        authors = authors .. string.format(&lt;br /&gt;
        	&amp;#039; \[[https://www.instagram.com/%s %s]\]&amp;#039;,&lt;br /&gt;
        	instagram_user, instagram_user)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    --the type of all authors, if applicable; should not be used if individual &amp;#039;author-typen&amp;#039; are set&lt;br /&gt;
    if data[&amp;#039;author-type&amp;#039;] then&lt;br /&gt;
    	authors = authors .. string.format(&amp;#039; (%s)&amp;#039;, data[&amp;#039;author-type&amp;#039;])&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return authors&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Assistant for url links section; formats either entry or title to be a link&lt;br /&gt;
local function formatUrl(data, to_format)&lt;br /&gt;
	if data[&amp;#039;archive-url&amp;#039;] and data[&amp;#039;brokenlink&amp;#039;] then&lt;br /&gt;
    	to_format = string.format(&amp;#039;[%s %s]&amp;#039;, data[&amp;#039;archive-url&amp;#039;], to_format)&lt;br /&gt;
    elseif data[&amp;#039;url&amp;#039;] then&lt;br /&gt;
    	to_format = string.format(&amp;#039;[%s %s]&amp;#039;, data[&amp;#039;url&amp;#039;], to_format)&lt;br /&gt;
    elseif data[&amp;#039;youtube-id&amp;#039;] then&lt;br /&gt;
    	to_format = string.format(&amp;#039;[https://www.youtube.com/watch?v=%s %s]&amp;#039;, data[&amp;#039;youtube-id&amp;#039;], to_format)&lt;br /&gt;
    elseif data[&amp;#039;tweet-id&amp;#039;] then&lt;br /&gt;
    	to_format = string.format(&amp;#039;[https://twitter.com/%s/status/%s %s]&amp;#039;, data[&amp;#039;author-id&amp;#039;], data[&amp;#039;tweet-id&amp;#039;], to_format)&lt;br /&gt;
    elseif data[&amp;#039;instagram-id&amp;#039;] then&lt;br /&gt;
    	to_format = string.format(&amp;#039;[https://instagram.com/p/%s %s]&amp;#039;, data[&amp;#039;instagram-id&amp;#039;], data[&amp;#039;instagram-id&amp;#039;], to_format)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return to_format&lt;br /&gt;
end&lt;br /&gt;
    &lt;br /&gt;
--Assistant for title section&lt;br /&gt;
local function formatTitle(data)&lt;br /&gt;
    local title = assert(data[&amp;#039;title&amp;#039;], &amp;#039;Title is mandatory&amp;#039;)&lt;br /&gt;
    &lt;br /&gt;
    if data[&amp;#039;link&amp;#039;] then&lt;br /&gt;
    	title = string.format(&amp;quot;[[%s|%s]]&amp;quot;, (data[&amp;#039;link&amp;#039;]), title)&lt;br /&gt;
    elseif not data[&amp;#039;entry&amp;#039;] and data[&amp;#039;url&amp;#039;] then&lt;br /&gt;
    	title = formatUrl(data, title)&lt;br /&gt;
    elseif data[&amp;#039;youtube-id&amp;#039;] then&lt;br /&gt;
    	title = string.format(&amp;#039;[https://www.youtube.com/watch?v=%s %s]&amp;#039;, data[&amp;#039;youtube-id&amp;#039;], title)&lt;br /&gt;
    elseif data[&amp;#039;tweet-id&amp;#039;] then&lt;br /&gt;
    	title = string.format(&amp;#039;[https://twitter.com/%s/status/%s %s]&amp;#039;, data[&amp;#039;author-id&amp;#039;], data[&amp;#039;tweet-id&amp;#039;], title)&lt;br /&gt;
    elseif data[&amp;#039;instagram-id&amp;#039;] then&lt;br /&gt;
    	title = string.format(&amp;#039;[https://www.instagram.com/p/%s %s]&amp;#039;, data[&amp;#039;instagram-id&amp;#039;], title)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
 	if not data[&amp;#039;noitalictitle&amp;#039;] then&lt;br /&gt;
 		title = string.format(&amp;quot;&amp;#039;&amp;#039;%s&amp;#039;&amp;#039;&amp;quot;, title)&lt;br /&gt;
 	else&lt;br /&gt;
 		title = string.format(&amp;#039;&amp;quot;%s&amp;quot;&amp;#039;, title)&lt;br /&gt;
    end&lt;br /&gt;
	&lt;br /&gt;
	return title&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Assistant for url archives links&lt;br /&gt;
local function formatArchive(url, accessdate, archiveurl, archivedate)&lt;br /&gt;
    local link = &amp;#039;&amp;#039;&lt;br /&gt;
    if archiveurl then&lt;br /&gt;
        link = archiveurl&lt;br /&gt;
    else&lt;br /&gt;
        link = string.format(&amp;#039;https://web.archive.org/web/%s&amp;#039;, url)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if archivedate then&lt;br /&gt;
    	return string.format(&amp;#039;Accessed %s. [%s Archived] from the original on %s. &amp;#039;, accessdate, link, archivedate)&lt;br /&gt;
    else&lt;br /&gt;
        return string.format(&amp;#039;[%s Archived] from the original on %s. &amp;#039;, link, accessdate)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Assistant for additional content on the end of a reference&lt;br /&gt;
local function additionalContent(data)&lt;br /&gt;
	local additional = &amp;#039;&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
    if data[&amp;#039;extra&amp;#039;] then&lt;br /&gt;
    	additional = &amp;#039;. &amp;#039; .. data[&amp;#039;extra&amp;#039;]&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if data[&amp;#039;publisher&amp;#039;] then&lt;br /&gt;
        additional = additional .. string.format(&amp;#039; %s. &amp;#039;, data[&amp;#039;publisher&amp;#039;])&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if data[&amp;#039;additional-authors&amp;#039;] then&lt;br /&gt;
    	additional = additional .. string.format(&amp;#039;%s. &amp;#039;, (data[&amp;#039;additional-authors&amp;#039;]))&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if data[&amp;#039;youtube-id&amp;#039;] then&lt;br /&gt;
    	additional = additional .. &amp;#039;[[wikipedia:YouTube|YouTube]]. &amp;#039;&lt;br /&gt;
    elseif data[&amp;#039;tweet-id&amp;#039;] then&lt;br /&gt;
    	additional = additional .. &amp;#039;[[wikipedia:Twitter|Twitter]]. &amp;#039;&lt;br /&gt;
    elseif data[&amp;#039;instagram-id&amp;#039;] then&lt;br /&gt;
    	additional = additional .. &amp;#039;[[wikipedia:Instagram|Instagram]]. &amp;#039;&lt;br /&gt;
    elseif data[&amp;#039;platform&amp;#039;] then&lt;br /&gt;
    	additional = additional .. string.format(&amp;#039; %s. &amp;#039;, data[&amp;#039;platform&amp;#039;])&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if data[&amp;#039;isbn&amp;#039;] then&lt;br /&gt;
        additional = additional .. string.format(&amp;#039;[[wikipedia:ISBN|ISBN]] [[Special:Booksources/%s|%s]]. &amp;#039;, (data[&amp;#039;isbn&amp;#039;]), (data[&amp;#039;isbn&amp;#039;]))&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    if data[&amp;#039;url&amp;#039;] and not data[&amp;#039;broken-link&amp;#039;] then&lt;br /&gt;
    	additional = additional .. formatArchive(data[&amp;#039;url&amp;#039;], assert(data[&amp;#039;access-date&amp;#039;], &amp;#039;Access dates are required for website references&amp;#039;), data[&amp;#039;archive-url&amp;#039;], data[&amp;#039;archive-date&amp;#039;])&lt;br /&gt;
    elseif data[&amp;#039;broken-link&amp;#039;] then&lt;br /&gt;
    	additional = additional .. string.format(&amp;#039;Archived from the [%s original] on %s. &amp;#039;, data[&amp;#039;url&amp;#039;], assert(data[&amp;#039;access-date&amp;#039;], &amp;#039;Access dates are required for website references&amp;#039;) or data[&amp;#039;archive-date&amp;#039;])&lt;br /&gt;
    end&lt;br /&gt;
	&lt;br /&gt;
	return additional&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C O N S T R U C T O R  F U N C T I O N S &amp;gt;-------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
fuctions to construct the full reference&lt;br /&gt;
&lt;br /&gt;
(note: only constructs Wikipedia CS1 ref at this stage)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
--constructs reference, in standard style similar to Wikipedia&amp;#039;s CS1.&lt;br /&gt;
local function constructWikiRef(data)&lt;br /&gt;
	local ref_content = &amp;#039;&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	--if author and date, print Author (Date)&lt;br /&gt;
	--n.d. if no date, no author if no author found&lt;br /&gt;
	has_author = (data[&amp;#039;last1&amp;#039;] or data[&amp;#039;last&amp;#039;] or data[&amp;#039;author1&amp;#039;] or data[&amp;#039;author&amp;#039;])&lt;br /&gt;
	if has_author then&lt;br /&gt;
		ref_content = formatAuthors(data) .. &amp;#039; &amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	has_date = (data[&amp;#039;year1&amp;#039;] or data[&amp;#039;year&amp;#039;])&lt;br /&gt;
	if has_date then&lt;br /&gt;
		ref_content = ref_content .. string.format(&amp;#039;(%s). &amp;#039;, formatDates(data))&lt;br /&gt;
	else&lt;br /&gt;
		ref_content = ref_content .. &amp;#039;(n.d.) . &amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
    &lt;br /&gt;
    --if pointing to a location in a source, Location in Title&lt;br /&gt;
    if data[&amp;#039;location&amp;#039;] then&lt;br /&gt;
    	ref_content = ref_content .. string.format(&amp;#039;&amp;quot;%s&amp;quot; in &amp;#039;, data[&amp;#039;location&amp;#039;])&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    --if the media type is included, add this either after title or entry name&lt;br /&gt;
    local media = &amp;#039;&amp;#039;&lt;br /&gt;
    if data[&amp;#039;media&amp;#039;] then&lt;br /&gt;
    	--first letter of the media type is capitalized&lt;br /&gt;
    	media = string.format(&amp;#039; [%s]&amp;#039;, data[&amp;#039;media&amp;#039;]:gsub(&amp;quot;^%l&amp;quot;, string.upper))&lt;br /&gt;
	end&lt;br /&gt;
    &lt;br /&gt;
    --if pointing to an entry of a work, &amp;quot;Entry&amp;quot; before Title&lt;br /&gt;
    if data[&amp;#039;entry&amp;#039;] then&lt;br /&gt;
    	local entry = data[&amp;#039;entry&amp;#039;]&lt;br /&gt;
    	if data[&amp;#039;entry-link&amp;#039;] then&lt;br /&gt;
    		entry = string.format(&amp;#039;[[%s|%s]]&amp;#039;, data[&amp;#039;entry-link&amp;#039;], data[&amp;#039;entry&amp;#039;])&lt;br /&gt;
    	elseif data[&amp;#039;url&amp;#039;] then&lt;br /&gt;
    		entry = formatUrl(data, entry)&lt;br /&gt;
    	end&lt;br /&gt;
    	ref_content = ref_content .. string.format(&amp;#039;&amp;quot;%s&amp;quot;&amp;#039;, entry)&lt;br /&gt;
	    if data[&amp;#039;season&amp;#039;] or data[&amp;#039;number&amp;#039;] then&lt;br /&gt;
	    	ref_content = ref_content .. &amp;#039; (&amp;#039; &lt;br /&gt;
	    	if data[&amp;#039;season&amp;#039;] then&lt;br /&gt;
	    		ref_content = ref_content .. data[&amp;#039;season&amp;#039;]&lt;br /&gt;
    		end&lt;br /&gt;
	    	if data[&amp;#039;season&amp;#039;] and data[&amp;#039;number&amp;#039;] then&lt;br /&gt;
	    		ref_content = ref_content .. &amp;#039;, &amp;#039;&lt;br /&gt;
    		end&lt;br /&gt;
	    	if data[&amp;#039;number&amp;#039;] then&lt;br /&gt;
	    		ref_content = ref_content .. data[&amp;#039;number&amp;#039;]&lt;br /&gt;
	    	end&lt;br /&gt;
    		ref_content = ref_content .. &amp;#039;) &amp;#039;&lt;br /&gt;
	    end&lt;br /&gt;
    	if data[&amp;#039;media&amp;#039;] then &lt;br /&gt;
	    	ref_content = ref_content .. media&lt;br /&gt;
	    end&lt;br /&gt;
	    ref_content = ref_content .. &amp;#039;. From &amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    --Title is mandatory&lt;br /&gt;
    ref_content = ref_content .. formatTitle(data)&lt;br /&gt;
    &lt;br /&gt;
	--if media type here, append title&lt;br /&gt;
	if data[&amp;#039;media&amp;#039;] and not data[&amp;#039;entry&amp;#039;] then &lt;br /&gt;
    	ref_content = ref_content .. media&lt;br /&gt;
    end&lt;br /&gt;
    --if volume or issue no., append title&lt;br /&gt;
    if data[&amp;#039;volume&amp;#039;] or data[&amp;#039;issue&amp;#039;] then&lt;br /&gt;
    	ref_content = ref_content .. &amp;#039; (&amp;#039; &lt;br /&gt;
    	if data[&amp;#039;volume&amp;#039;] then&lt;br /&gt;
    		ref_content = ref_content .. data[&amp;#039;volume&amp;#039;]&lt;br /&gt;
		end&lt;br /&gt;
    	if data[&amp;#039;volume&amp;#039;] and data[&amp;#039;issue&amp;#039;] then&lt;br /&gt;
    		ref_content = ref_content .. &amp;#039;, &amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
    	if data[&amp;#039;issue&amp;#039;] then&lt;br /&gt;
    		ref_content = ref_content .. data[&amp;#039;issue&amp;#039;]&lt;br /&gt;
    	end&lt;br /&gt;
		ref_content = ref_content .. &amp;#039;) &amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    --period after title either way&lt;br /&gt;
	ref_content = ref_content .. &amp;#039;. &amp;#039;&lt;br /&gt;
    &lt;br /&gt;
    --if pointing to a page number, add page number after Title&lt;br /&gt;
    if data[&amp;#039;p&amp;#039;] or data[&amp;#039;page&amp;#039;] then&lt;br /&gt;
    	ref_content = ref_content .. string.format(&amp;#039; p. %s.&amp;#039;, (data[&amp;#039;p&amp;#039;] or data[&amp;#039;page&amp;#039;]))&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    --added additional fields to be appended at the end&lt;br /&gt;
    ref_content = ref_content .. string.format(&amp;#039; %s&amp;#039;, additionalContent(data))&lt;br /&gt;
    &lt;br /&gt;
    return ref_content&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A I N  F U N C T I O N S &amp;gt;-------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
process parameter input to return reference&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
--function to take argument inputs to pass to core functions&lt;br /&gt;
--parameter inputs override autogeeration&lt;br /&gt;
local function coreInput(frame)&lt;br /&gt;
	--parameters/data&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	local data = {}&lt;br /&gt;
	&lt;br /&gt;
	if args[&amp;#039;game&amp;#039;] then&lt;br /&gt;
	    game = assert(ref.sourcedata[args[&amp;#039;game&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
	    game_version = game&lt;br /&gt;
	    if args[&amp;#039;version&amp;#039;] then&lt;br /&gt;
	    	game_version = assert(game[&amp;#039;versions&amp;#039;][args[&amp;#039;version&amp;#039;]], &amp;#039;Could not find version matching this input&amp;#039;)&lt;br /&gt;
    	end&lt;br /&gt;
    	gameRef(data, game, game_version)&lt;br /&gt;
	elseif args[&amp;#039;movie&amp;#039;] then&lt;br /&gt;
	    movie = assert(ref.sourcedata[args[&amp;#039;movie&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
	    movie_version = movie&lt;br /&gt;
	    if args[&amp;#039;version&amp;#039;] then&lt;br /&gt;
	    	movie_version = assert(movie[&amp;#039;versions&amp;#039;][args[&amp;#039;version&amp;#039;]], &amp;#039;Could not find version matching this input&amp;#039;)&lt;br /&gt;
    	end&lt;br /&gt;
    	movieRef(data, movie, movie_version)&lt;br /&gt;
	elseif args[&amp;#039;episode&amp;#039;] then&lt;br /&gt;
	    episode = assert(ref.sourcedata[args[&amp;#039;episode&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
	    series = ref.sourcedata[episode[&amp;#039;series&amp;#039;]]&lt;br /&gt;
    	episodeRef(data, episode, series)&lt;br /&gt;
	elseif args[&amp;#039;series&amp;#039;] then&lt;br /&gt;
	    series = assert(ref.sourcedata[args[&amp;#039;series&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
    	seriesRef(data, series)&lt;br /&gt;
	elseif args[&amp;#039;book&amp;#039;] then&lt;br /&gt;
	    book = assert(ref.sourcedata[args[&amp;#039;book&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
	    if args[&amp;#039;version&amp;#039;] then&lt;br /&gt;
	    	book = assert(book[&amp;#039;versions&amp;#039;][args[&amp;#039;version&amp;#039;]], &amp;#039;Could not find version matching this input&amp;#039;)&lt;br /&gt;
    	end&lt;br /&gt;
    	bookRef(data, book)&lt;br /&gt;
	elseif args[&amp;#039;db&amp;#039;] then &lt;br /&gt;
	    game = assert(ref.sourcedata[args[&amp;#039;db&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
		db = assert(game[&amp;#039;db&amp;#039;], &amp;#039;Could not find a design bible for this game&amp;#039;)&lt;br /&gt;
	    if args[&amp;#039;version&amp;#039;] then&lt;br /&gt;
	    	db = assert(db[args[&amp;#039;version&amp;#039;]], &amp;#039;Could not find version matching this input&amp;#039;)&lt;br /&gt;
    	end&lt;br /&gt;
    	bookRef(data, db)&lt;br /&gt;
	elseif args[&amp;#039;guide&amp;#039;] then&lt;br /&gt;
	    game = assert(ref.sourcedata[args[&amp;#039;guide&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
		guide = assert(game[&amp;#039;guide&amp;#039;], &amp;#039;Could not find a guide for this game&amp;#039;)&lt;br /&gt;
	    if args[&amp;#039;version&amp;#039;] then&lt;br /&gt;
	    	guide = assert(guide[args[&amp;#039;version&amp;#039;]], &amp;#039;Could not find version matching this input&amp;#039;)&lt;br /&gt;
    	end&lt;br /&gt;
    	bookRef(data, guide)&lt;br /&gt;
	elseif args[&amp;#039;album&amp;#039;] then&lt;br /&gt;
	    album = assert(ref.sourcedata[args[&amp;#039;album&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
	    album_version = album&lt;br /&gt;
	    if args[&amp;#039;version&amp;#039;] then&lt;br /&gt;
	    	album_version = assert(album[&amp;#039;versions&amp;#039;][args[&amp;#039;version&amp;#039;]], &amp;#039;Could not find version matching this input&amp;#039;)&lt;br /&gt;
    	end&lt;br /&gt;
    	albumRef(data, album, album_version)&lt;br /&gt;
	elseif args[&amp;#039;song&amp;#039;] then&lt;br /&gt;
	    song = assert(ref.sourcedata[args[&amp;#039;song&amp;#039;]], &amp;#039;Could not find an entry in shorthand data module matching this input&amp;#039;)&lt;br /&gt;
	    song_version = song&lt;br /&gt;
	    if args[&amp;#039;version&amp;#039;] then&lt;br /&gt;
	    	song_version = assert(song[&amp;#039;versions&amp;#039;][args[&amp;#039;version&amp;#039;]], &amp;#039;Could not find version matching this input&amp;#039;)&lt;br /&gt;
    	end&lt;br /&gt;
    	songRef(data, song, song_version)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
	--merge data and args, where args takes priority&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		data[k] = v or data[k]&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	--automatic types for refs not auto-generated&lt;br /&gt;
	if data[&amp;#039;url&amp;#039;] then&lt;br /&gt;
		data[&amp;#039;showfulldate&amp;#039;] = true&lt;br /&gt;
	elseif data[&amp;#039;youtube-id&amp;#039;] then&lt;br /&gt;
		data[&amp;#039;media&amp;#039;] = &amp;#039;video&amp;#039;&lt;br /&gt;
    	data[&amp;#039;showfulldate&amp;#039;] = true&lt;br /&gt;
	elseif data[&amp;#039;tweet-id&amp;#039;] then&lt;br /&gt;
		data[&amp;#039;media&amp;#039;] = &amp;#039;tweet&amp;#039;&lt;br /&gt;
    	data[&amp;#039;showfulldate&amp;#039;] = true&lt;br /&gt;
	elseif data[&amp;#039;instagram-id&amp;#039;] then&lt;br /&gt;
		data[&amp;#039;media&amp;#039;] = &amp;#039;instagram&amp;#039;&lt;br /&gt;
    	data[&amp;#039;showfulldate&amp;#039;] = true&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
    local id = makeId(data)&lt;br /&gt;
	&lt;br /&gt;
	return data, id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--pass to this function to build reference&lt;br /&gt;
local function coreOutput(ref_content, id)&lt;br /&gt;
    refoutput = mw.html.create(&amp;#039;span&amp;#039;)&lt;br /&gt;
    	:attr(&amp;#039;id&amp;#039;, id)&lt;br /&gt;
    	:wikitext(ref_content)&lt;br /&gt;
	&lt;br /&gt;
	return refoutput&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--returns reference in wiki-style format&lt;br /&gt;
function ref.wiki(frame)&lt;br /&gt;
	local data, id = coreInput(frame)&lt;br /&gt;
	local ref_content = constructWikiRef(data)&lt;br /&gt;
	return coreOutput(ref_content, id)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--main function (defaults to wiki reference)&lt;br /&gt;
ref.main = ref.wiki&lt;br /&gt;
&lt;br /&gt;
--when importing this module, fill sourcedata table from another given module or input&lt;br /&gt;
function ref.custom_sourcedata(...)&lt;br /&gt;
	local sourcedata = {...}&lt;br /&gt;
	for i,source in ipairs(sourcedata) do&lt;br /&gt;
	    for k, val in pairs(source) do&lt;br /&gt;
    		ref.sourcedata[k] = val&lt;br /&gt;
	    end&lt;br /&gt;
	end&lt;br /&gt;
    return ref&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return ref&lt;/div&gt;</summary>
		<author><name>Admin coral island</name></author>
	</entry>
</feed>