-- A set of modules to deal with transcripts. See Template:Story_Transcript .
local _ = {}
function iconAlt (char_id, img_override, gametitle)
local result = ""
if img_override ~= nil and img_override ~= "" then
result = img_override
elseif char_id ~= nil and char_id ~= "" then
result = "Story Icon " .. char_id .. ".png"
-- this will have to be fixed in the python script, for now I have no magireco transcripts to worry about so I'm leaving "empty" as an option in
if gametitle == "Exedra" or gametitle == nil or gametitle == "" then
result = "Exedra " .. result
elseif gametitle == "MagiReco" then
result = "MagiReco " .. result
end
end
if result ~= "" then
result = "[[File:" .. result .. "|80px]]"
end
return result
end
function chAlt (charname_en, charname_jp, charlink_initial)
local charlink_final = ""
local result = charname_en
local category = ""
--also prepare nonmagireco link characters one day
local categorizable_chars = mw.loadJsonData [[Module:Tscript/categorizable_chars.json]]
local nonexedra_link_characters = mw.loadJsonData [[Module:Tscript/nonexedra_link_characters.json]]
if charname_jp ~= nil and charname_jp ~= "" then
result = charname_en .. " / " .. charname_jp
end
for i, value in ipairs(categorizable_chars) do
if value == charname_en then
category = "[[Category:" .. charname_en .. " in Story]]"
if charlink_initial == nil or charlink_initial == "" then
charlink_final = charname_en .. " in Magia Exedra"
end
break
end
end
if (charlink_initial == nil or charlink_initial == "") and nonexedra_link_characters[charname_en] ~= nil then
charlink_final = nonexedra_link_characters[charname_en]
elseif charlink_initial ~= nil and charlink_initial ~= "" then
charlink_final = charlink_initial
end
if charlink_final ~= nil and charlink_final ~= "" then
result = "[[" .. charlink_final .. "|" .. result .. "]]"
end
if result == nil then
result = ""
end
return result .. category
end
function vAlt (v1,v2,v3,v4)
local r = ""
if v1 ~= nil and v1 ~= "" then
r = "[[File:" .. v1 .. ".ogg]]"
if v2 ~= nil and v2 ~= "" then
r = r .. "[[File:" .. v2 .. ".ogg]]"
if v3 ~= nil and v3 ~= "" then
r = r .. "[[File:" .. v3 .. ".ogg]]"
if v4 ~= nil and v4 ~= "" then
r = r .. "[[File:" .. v4 .. ".ogg]]"
end
end
end
end
return r
end
-- icon - A function to deal with character icon
_.icon = function(frame)
local char_id = frame.args[1]
local img_override = frame.args[2]
local gametitle = frame.args[3]
local result = ""
if img_override ~= nil and img_override ~= "" then
result = img_override
elseif char_id ~= nil and char_id ~= "" then
result = "Story Icon " .. char_id .. ".png"
-- this will have to be fixed in the python script, for now I have no magireco transcripts to worry about so I'm leaving "empty" as an option in
if gametitle == "Exedra" or gametitle == nil or gametitle == "" then
result = "Exedra " .. result
elseif gametitle == "MagiReco" then
result = "MagiReco " .. result
end
end
if result ~= "" then
result = "[[File:" .. result .. "|80px]]"
end
return result
end
-- ch - A function to deal with character naming, linking, categorizing.
_.ch = function(frame)
-- first argument is also the en charname
local charname_en = frame.args[1]
local charname_jp = frame.args[2]
local charlink_initial = frame.args[3]
local charlink_final = ""
local result = charname_en
local category = ""
--also prepare nonmagireco link characters one day
local categorizable_chars = mw.loadJsonData [[Module:Tscript/categorizable_chars.json]]
local nonexedra_link_characters = mw.loadJsonData [[Module:Tscript/nonexedra_link_characters.json]]
if charname_jp ~= nil and charname_jp ~= "" then
result = charname_en .. " / " .. charname_jp
end
for i, value in ipairs(categorizable_chars) do
if value == charname_en then
category = "[[Category:" .. charname_en .. " in Story]]"
if charlink_initial == nil or charlink_initial == "" then
charlink_final = charname_en .. " in Magia Exedra"
end
break
end
end
if (charlink_initial == nil or charlink_initial == "") and nonexedra_link_characters[charname_en] ~= nil then
charlink_final = nonexedra_link_characters[charname_en]
elseif charlink_initial ~= nil and charlink_initial ~= "" then
charlink_final = charlink_initial
end
if charlink_final ~= nil and charlink_final ~= "" then
result = "[[" .. charlink_final .. "|" .. result .. "]]"
end
if result == nil then
result = ""
end
return result .. category
end
-- v - a function for dealing with voicelines.
_.v = function(frame)
local v1 = frame.args[1]
local v2 = frame.args[2]
local v3 = frame.args[3]
local v4 = frame.args[4]
local r = ""
if v1 ~= nil and v1 ~= "" then
r = "[[File:" .. v1 .. ".ogg]]"
if v2 ~= nil and v2 ~= "" then
r = r .. "[[File:" .. v2 .. ".ogg]]"
if v3 ~= nil and v3 ~= "" then
r = r .. "[[File:" .. v3 .. ".ogg]]"
if v4 ~= nil and v4 ~= "" then
r = r .. "[[File:" .. v4 .. ".ogg]]"
end
end
end
end
return r
end
-- d - a function for dialogue.
_.d = function(frame)
local en = frame.args[1]
local jp = frame.args[2]
local result = ""
if en == nil then
en = ""
end
if jp ~= nil and jp ~= "" then
result = '<td style="width: 40%;">' .. en .. '</td><td style="width: 40%;">' .. jp .. '</td>'
else
result = '<td style="width: 80%;">' .. en .. '</td>'
end
return result
end
-- n - a function for narration. should be almost identical to d
_.n = function(frame)
local en = frame.args[1]
local jp = frame.args[2]
local result = ""
if en == nil then
en = ""
end
if jp ~= nil and jp ~= "" then
result = '<td style="width: 40%;"><i style="opacity:80%">' .. en .. '</i></td><td style="width: 40%;"><i style="opacity:80%">' .. jp .. '</i></td>'
else
result = '<td style="width: 80%;"><i style="opacity:80%">' .. en .. '</i></td>'
end
return result
end
-- cs - a function for proper colspan for Music and Illustration, depending on whether the transcript is a legacy English-only one, or a bilingual one.
_.cs = function(frame)
local a = frame.args[1]
local result = 'colspan=2'
if a ~= nil and a ~= "" then
result = 'colspan=3'
end
return result
end
-- nm - a function for the side nameplate in Dialogue and Narration
_.nm = function(frame)
local name_en = frame.args[1]
local name_jp = frame.args[2]
local charlink = frame.args[3]
local char_id = frame.args[4]
local img_override = frame.args[5]
local gametitle = frame.args[6]
local narration = frame.args[7]
local voicefile1 = frame.args[8]
local voicefile2 = frame.args[9]
local voicefile3 = frame.args[10]
local voicefile4 = frame.args[11]
local result = ""
local iconimg = iconAlt(char_id, img_override, gametitle)
if narration ~= nil and narration ~= "" then
result = result .. "<div style=\"width:80px;\" class=\"littlecontainer\">(Narration)</div>"
elseif iconimg ~= "" then
result = result .. "<div style=\"width:80px;\" class=\"littlecontainer\">" .. iconimg .. "</div>"
end
if (name_en ~= nil and name_en ~= "") or (name_jp ~= nil and name_jp ~= "") then
result = result .. "<div class=\"littlecontainer\">" .. chAlt(name_en, name_jp, charlink) .. "</div>"
end
if result ~= "" then
result = "<center><div class=\"bigcontainer\">" .. result .. "</div></center>"
end
if voicefile1 ~= nil and voicefile1 ~= "" then
result = result .. "<div>" .. vAlt(voicefile1, voicefile2, voicefile3, voicefile4) .. "</div>"
end
result = "<th style=\"width: 20%\">" .. result .. "</th>"
return result
end
return _