Changes

no edit summary
Line 262: Line 262:  
         battle_card = battle_card and ("<br>" .. ShipBattleCardKai:Asset({ name, link = "nil", damaged = damaged })) or ""
 
         battle_card = battle_card and ("<br>" .. ShipBattleCardKai:Asset({ name, link = "nil", damaged = damaged })) or ""
 
     }
 
     }
 +
end
 +
 +
function getFirstSeason(season)
 +
    if type(season) == "table" then
 +
        if type(season[1]) == "table" then
 +
            return season[1][1]
 +
        else
 +
            return season[1]
 +
        end
 +
    else
 +
        return season
 +
    end
 +
end
 +
 +
function formatSeason(season)
 +
    local seasons = type(season) == "table" and season or { season }
 +
    local strings = U.imap(seasons, function(season)
 +
        if type(season) == "table" then
 +
            return format{"[[Seasonal/${season_link}|${season_name}]]", season_link = season[1], season_name = season[2]}
 +
        else
 +
            return format{"[[Seasonal/${season}|${season}]]", season = season}
 +
        end
 +
    end)
 +
    return table.concat(strings, ", ")
 
end
 
end
   Line 270: Line 294:  
                 return form.season_suffix
 
                 return form.season_suffix
 
             end
 
             end
             local season = form.season or "" -- string.match(form.season, "(.*) 20%d%d") or form.season
+
             local season = getFirstSeason(form.season) or "" -- string.match(form.season, "(.*) 20%d%d") or form.season
 
             local suffixInSeason = string.find(season, suffix)
 
             local suffixInSeason = string.find(season, suffix)
 
             local seasonInSuffix = string.find(suffix, season)
 
             local seasonInSuffix = string.find(suffix, season)
Line 287: Line 311:  
     end
 
     end
 
end
 
end
 +
 +
    
function ShipPage.Gallery(frame, args)
 
function ShipPage.Gallery(frame, args)
Line 305: Line 331:  
             if form.season and not title then
 
             if form.season and not title then
 
                 table.insert(result, format{
 
                 table.insert(result, format{
                     "<h3>[[Seasonal/${season}|${season}]]</h3>",
+
                     "<h3>${seasons}</h3>",
                     season = form.season
+
                     seasons = formatSeason(form.season)
 
                 })
 
                 })
 
             elseif form.season then
 
             elseif form.season then
 
                 table.insert(result, format{
 
                 table.insert(result, format{
                     "<h3>[[Seasonal/${season}|${season} (${title})]]</h3>",
+
                     "<h3>${seasons} (${title})</h3>",
 
                     title = title,
 
                     title = title,
                     season = form.season
+
                     seasons = formatSeason(form.season)
 
                 })
 
                 })
 
             else
 
             else
cssedit, gkautomate
7,060

edits