Module:Citation

From Otherkin Wiki
Revision as of 14:47, 4 April 2023 by imported>Jazzhorse (creating lua module to handle some more elaborate citation components. will it work? only time will tell...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

function p.comment_on(title, url)												-- formats the 'comment on' bit depending on if a url, title or both are provided
	if not title or url then	
		return false;															-- if comment fields aren't filled, no need to continue
	end
	
	if title and url then														-- there are probably less redundant ways to form the text than this but it gets the job done
		return string.format("'Comment on \"[%s %s]\"'", url, title)									
	elseif title then
		return string.format("'Comment on \"%s\"'", title)									
	elseif url then
		return string.format("'Comment on %s'", url)
	end
	
end	

return p