Module:Quotes

local format = require('Module:StringInterpolation').format

local templates = { header = {| class="wikitable typography-xl-optout", footer = "|}", audio_file = "${ship}${suffix}-${line}.ogg", first_row_style = style="border-top: 3px solid , row = [=[|- ${style} ${en_cell}| ${note}]=], }
 * nowrap="nowrap" |[[Media:${audio_file}|Play]] ${line}
 * colspan="${ja_colspan}" | ${ja}

local lines = { "Introduction", "Library", "Secretary 1", "Secretary 2", "Secretary 3", "Idle", "Secretary Married", "Wedding", "Looking At Scores", "Joining A Fleet", "Equipment 1", "Equipment 2", "Equipment 3", "Supply", "Docking Minor", "Docking Major", "Docking Complete", "Construction", "Returning From Sortie", "Starting A Sortie", "Battle Start", "Attack", "Night Battle", "Night Attack", "MVP", "Minor Damage 1", "Minor Damage 2", "Major Damage", "Sunk", }

function insertRow(result, remodel, args, line) local remodel_string = remodel == 0 and "" or "/" .. remodel local ja, en, note = args[line .. remodel_string], args[line .. remodel_string .. "/En"], args[line .. remodel_string .. "/Note"] if remodel == 0 or ja or en or note then table.insert(result, format{           templates.row,            style = remodel == 0 and templates.first_row_style or "",            audio_file = format{templates.audio_file, ship = args.ship, suffix = ({[0] = "", [1] = "Kai", [2] = "Kai2"})[remodel], line = line},            line = line,            ja = ja or "",            ja_colspan = ja and not en and "2" or "1",            en_cell = ja and not en and "" or "|" .. (en or "") .. "\n",            note = note or "",        }) end end

local Quotes = {}

function Quotes.ShipQuotes(frame, args) local result = {} local ship = args.ship table.insert(result, templates.header) for _, line in pairs(lines) do       insertRow(result, 0, args, line) insertRow(result, 1, args, line) insertRow(result, 2, args, line) end table.insert(result, templates.footer) return table.concat(result, "\n") end

return Quotes