Module:ShipSeasonalQuotes

local Utils = require("Module:Utils") local format = require("Module:StringInterpolation").format

local templates = { header = Event !Japanese !English !Note, footer = "|}", row = [=[|- as_ship = As ${ship} }
 * nowrap="nowrap"|${season} [[Media:${ship} ${season}.ogg|Play]]
 * lang="ja"|${ja}
 * ${en}
 * ${note}]=],

local seasons = { "Christmas 2013", "Christmas 2014", "End of Year 2014", "New Year 2015", "New Year 2016", "Second Anniversary", "Setsubun 2015", "Setsubun 2016", "Setsubun 2017", "Valentines 2015", "White Day 2015", }

local ShipSeasonalQuotes = {}

function addRow(result, seasonData, season, ship, note_prefix) local shipData = seasonData.ships[ship] if shipData then for _, lineData in ipairs(shipData) do           table.insert(result, format{                templates.row,                ship = ship,                season = season,                ja = lineData.ja,                en = lineData.en,                note = (note_prefix or "") .. (note_prefix and lineData.note and " " or "") .. (lineData.note or ""),            }) end end end

function ShipSeasonalQuotes.format(frame, args) args = args or Utils.getTemplateArgs(frame) local ship = args.implicit.pagename or args.explicit.ship or "" local ship2 = args.explicit.ship2 local result = {} table.insert(result, templates.header) for _, season in ipairs(seasons) do       local seasonData = require(string.format("Module:Seasonal/%s", season)) if ship2 then addRow(result, seasonData, season, ship, format{templates.as_ship, ship = ship}) addRow(result, seasonData, season, ship2, format{templates.as_ship, ship = ship2}) else addRow(result, seasonData, ship) end end table.insert(result, templates.footer) return table.concat(result, "\n") end

-- ShipSeasonalQuotes.t = ShipSeasonalQuotes.format(nil, { implicit = { pagename = "Taigei" }, explicit = { ship2 = "Ryuuhou" } })

return ShipSeasonalQuotes