Content added Content deleted
(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...") |
m (ChaoticShadow moved page Module:VocalVersionsLine to Module:Song versions line without leaving a redirect) |
||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local |
local getArgs = require('Module:Arguments').getArgs |
||
local utils = require('Module:Utilities') |
|||
local constants = require('Module:Constants') |
|||
local yesno = require('Module:Yesno') |
|||
local p = {} |
local p = {} |
||
local function |
local function formatSingers(arg) |
||
if arg and arg ~= '' then |
if arg and arg ~= '' then |
||
local splits = utils.split(arg, ",") |
|||
for i=1,#splits do |
|||
else |
|||
splits[i] = mw.text.trim(splits[i]) |
|||
⚫ | |||
if constants.get_character(splits[i]) ~= nil then |
|||
splits[i] = '[[' .. splits[i] .. ']]' |
|||
⚫ | |||
⚫ | |||
return mw.text.listToText(splits) |
|||
end |
end |
||
⚫ | |||
⚫ | |||
end |
|||
local function formatFile(arg) |
|||
if arg and arg ~= '' then |
|||
return '[[File:' .. arg .. ']]' |
|||
end |
|||
return nil |
|||
end |
end |
||
function p.main(frame) |
function p.main(frame) |
||
local args = |
local args = getArgs(frame) |
||
local root = mw.html.create('tr') |
local root = mw.html.create('tr') |
||
local categories = '' |
|||
root:tag('td'):wikitext |
root:tag('td'):wikitext(args['version']) |
||
root:tag('td'):wikitext( |
root:tag('td'):wikitext(formatSingers(args['singers'])) |
||
root:tag('td'):wikitext( |
root:tag('td'):wikitext(formatFile(args['audio'])) |
||
⚫ | |||
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]]" |
|||
⚫ | |||
⚫ | |||
return tostring(root) |
return tostring(root) |
||
end |
end |
||
Latest revision as of 17:06, 24 July 2022
Documentation for this module may be created at Module:Song versions line/doc
local getArgs = require('Module:Arguments').getArgs
local utils = require('Module:Utilities')
local constants = require('Module:Constants')
local yesno = require('Module:Yesno')
local p = {}
local function formatSingers(arg)
if arg and arg ~= '' then
local splits = utils.split(arg, ",")
for i=1,#splits do
splits[i] = mw.text.trim(splits[i])
if constants.get_character(splits[i]) ~= nil then
splits[i] = '[[' .. splits[i] .. ']]'
end
end
return mw.text.listToText(splits)
end
return nil
end
local function formatFile(arg)
if arg and arg ~= '' then
return '[[File:' .. arg .. ']]'
end
return nil
end
function p.main(frame)
local args = getArgs(frame)
local root = mw.html.create('tr')
root:tag('td'):wikitext(args['version'])
root:tag('td'):wikitext(formatSingers(args['singers']))
root:tag('td'):wikitext(formatFile(args['audio']))
return tostring(root)
end
return p