Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Song versions line

From Sekaipedia
Revision as of 20:50, 7 August 2021 by ChaoticShadow (talk | contribs) (Created page with "local utils = require('Module:Utilities') local p = {} local function formatArg(arg) if arg and arg ~= '' then return table.concat(utils.split(arg, "\n"), "<br>") else...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Song versions line/doc

local utils = require('Module:Utilities')

local p = {}

local function formatArg(arg)
	if arg and arg ~= '' then
		return table.concat(utils.split(arg, "\n"), "<br>")
	else
		return "<br>"
	end
end

function p.main(frame)
	local args = frame:getParent().args
	
	local root = mw.html.create('tr')
	local categories = ''
	
	root:tag('td'):wikitext(formatArg(args['japanese']))
	root:tag('td'):wikitext(formatArg(args['romaji']))
	root:tag('td'):wikitext(formatArg(args['english']))
	
	if mw.title.getCurrentTitle().namespace == 0 then
		if args['japanese'] and (args['english'] == nil or args['english'] == '') then
			categories = "[[Category:Songs with missing English translations]]"
		elseif 
			(args['japanese'] == nil or args['japanese'] == '') and
			(args['romaji'] == nil or args['romaji'] == '') and
			(args['english'] == nil or args['english'] == '') then
			categories = "[[Category:Songs with missing lyrics]]"
		end
	end 
	
	return tostring(root) .. categories
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.