Module:Infobox ship/data

--[[--< S T Y L E S >--

TODO: move these into templatestyles css

]]

local styles_t = {																-- these are variations on the styles from Module:WPMILHIST Infobox style mainbox = 'width:25.5em;border-spacing:2px;', history = 'background-color:#C3D6EF;text-align:center;vertical-align:middle;font-size:110%;';	-- infobox career history header country = 'height:30px;background-color:#B0C4DE;text-align:left;padding-left:2px;vertical-align:middle;font-size:110%;';	-- infobox career flag & country header general = 'height:30px;background-color:#C3D6EF;vertical-align:middle;font-size:110%;';			-- infobox characteristics & class overview headers }

--[[--< W A R N I N G  M E S S A G E >

These style cannot be moved to templatestyles css because mw.addWarning does not understand apply css

]]

local warn_span_style = 'color:#d33';											-- these styles local warn_code_style = 'color: inherit; background: inherit; border: none; padding: inherit;'; local warning_fmt_str = ' : unknown parameter: ';

--[[--< I N F O B O X  P A R A M E T E R S >--

These tables hold the names and define the rendering order of the label/data pairs in the associated infoboxen. Each table is a sequence of sub-sequences where each subsequence holds [1] the parameter name [2] the rendered label for that parameter's value

]]

local infobox_career_params_t = {												-- table of parameters that are rendered in the same way {'ship_name', 'Name'}, {'ship_namesake', 'Namesake'}, {'ship_owner', 'Owner'}, {'ship_operator', 'Operator'}, {'ship_registry', 'Port of registry'}, {'ship_route', 'Route'}, {'ship_ordered', 'Ordered'}, {'ship_awarded', 'Awarded'}, {'ship_builder', 'Builder'}, {'ship_original_cost', 'Cost'}, {'ship_yard_number', 'Yard number'}, {'ship_way_number', 'Way number'}, {'ship_laid_down', 'Laid down'}, {'ship_launched', 'Launched'}, {'ship_sponsor', 'Sponsored by'}, {'ship_christened', 'Christened'}, {'ship_completed', 'Completed'}, {'ship_acquired', 'Acquired'}, {'ship_commissioned', 'Commissioned'}, {'ship_recommissioned', 'Recommissioned'}, {'ship_decommissioned', 'Decommissioned'}, {'ship_maiden_voyage', 'Maiden voyage'}, {'ship_in_service', 'In service'}, {'ship_out_of_service', 'Out of service'}, {'ship_renamed', 'Renamed'}, {'ship_reclassified', 'Reclassified'}, {'ship_refit', 'Refit'}, {'ship_struck', 'Stricken'}, {'ship_stricken', 'Stricken'}, {'ship_reinstated', 'Reinstated'}, {'ship_homeport', 'Homeport'}, {'ship_identification', 'Identification'}, {'ship_motto', 'Motto'}, {'ship_nickname', 'Nickname(s)'}, {'ship_honours', 'Honours and awards'},								-- make these two the same index? {'ship_honors', 'Honors and awards'}, {'ship_captured', 'Captured'}, {'ship_fate', 'Fate'}, {'ship_status', 'Status'}, {'ship_career_notes', 'Notes'},												-- renamed from ship_notes because duplicated name {'ship_badge', 'Badge'}, }

local infobox_characteristics_params_t = {										-- table of parameters that are rendered in the same way {'ship_class', 'Class and type'}, {'ship_type', 'Type'}, {'ship_tonnage', 'Tonnage'}, {'ship_displacement', 'Displacement'}, {'ship_tons burthen', 'Tons burthen'}, {'ship_length', 'Length'}, {'ship_beam', 'Beam'}, {'ship_height', 'Height'}, {'ship_draught', 'Draught'}, {'ship_draft', 'Draft'}, {'ship_depth', 'Depth'}, {'ship_hold_depth', 'Depth of hold'}, {'ship_decks', 'Decks'}, {'ship_deck_clearance', 'Deck clearance'}, {'ship_ramps', 'Ramps'}, {'ship_ice_class', 'Ice class'}, {'ship_power', 'Installed power'}, {'ship_propulsion', 'Propulsion'}, {'ship_sail_plan', 'Sail plan'}, {'ship_speed', 'Speed'}, {'ship_range', 'Range'}, {'ship_endurance', 'Endurance'}, {'ship_test_depth', 'Test depth'}, {'ship_boats', 'Boats & landing craft carried'}, {'ship_capacity', 'Capacity'}, {'ship_troops', 'Troops'}, {'ship_complement', 'Complement'}, {'ship_crew', 'Crew'}, {'ship_time_to_activate', 'Time to activate'}, {'ship_sensors', 'Sensors and processing systems'}, {'ship_EW', 'Electronic warfare & decoys'}, {'ship_armament', 'Armament'}, {'ship_armour', 'Armour'}, {'ship_armor', 'Armor'}, {'ship_aircraft', 'Aircraft carried'}, {'ship_aircraft_facilities', 'Aviation facilities'}, {'ship_characteristics_notes', 'Notes'},									-- renamed from ship_notes because duplicated name }

local infobox_class_overview_params_t = {										-- table of parameters that are rendered in the same way {'name', 'Name'}, {'builders', 'Builders'}, {'operators', 'Operators'}, {'class_before', 'Preceded by'}, {'class_after', 'Succeeded by'}, {'subclasses', 'Subclasses'}, {'cost', 'Cost'}, {'built_range', 'Built'}, {'in_service_range', 'In service'}, {'in_commission_range', 'In commission'}, {'total_ships_planned', 'Planned'}, {'total_ships_on_order', 'On order'}, {'total_ships_building', 'Building'}, {'total_ships_completed', 'Completed'}, {'total_ships_cancelled', 'Cancelled'}, {'total_ships_active', 'Active'}, {'total_ships_laid up', 'Laid up'}, {'total_ships_lost', 'Lost'}, {'total_ships_retired', 'Retired'}, {'total_ships_scrapped', 'Scrapped'}, {'total_ships_preserved', 'Preserved'}, }

local infobox_ship_service_record_params_t = {									-- table of parameters that are rendered in the same way {'partof', 'Part of'}, {'codes', 'Identification codes'}, {'commanders', 'Commanders'}, {'operations', 'Operations'}, {'victories', 'Victories'}, {'awards', 'Awards'}, }

--[[--< K N O W N  P A R A M E T E R   T A B L E S >--

These tables for detecting unknown parameters

]]

local known_infobox_ship_params_t = {											-- all parameters known to 	['data#'] = true,															-- these native to infobox ship ['label#'] = true, ['section#'] = true,

display_title = true,														-- these native to infobox_ship_begin infobox_caption = true, sclass = true, showerrs = true, }

local known_infobox_ship_image_params_t = {										-- all parameters known to 	caption = true, image = true, image_alt = true, image_size = true, image_caption = true, }

local known_infobox_ship_career_params_t = {									-- non-line-item parameters known to 	child = true,																-- |child= may go away hide_header = true, ship_country = true, ship_flag = true, } local known_infobox_ship_characteristics_params_t = {							-- non-line-item parameters known to 	child = true,																-- |child= may go away header_caption = true, hide_header = true, } local known_infobox_ship_class_overview_params_t = {							-- non-line-item parameters known to 	child = true,																-- |child= may go away hide_header = true, } local known_infobox_ship_service_record_params_t = {							-- non-line-item parameters known to 	child = true,																-- |child= may go away hide_header = true, label = true, }

for _, tables_t in ipairs (	{																			-- this table maps line-item tables with known parameter tables	{infobox_career_params_t, known_infobox_ship_career_params_t},	{infobox_characteristics_params_t, known_infobox_ship_characteristics_params_t},	{infobox_class_overview_params_t, known_infobox_ship_class_overview_params_t},	{infobox_ship_service_record_params_t, known_infobox_ship_service_record_params_t},	}) do																		-- now fill known parameter tables from line-item tables for _, line_t in ipairs (tables_t[1]) do								--  is sequence of parameter name [1] and displayed label [2] tables_t[2][line_t[1]] = true;										-- known-parameters table gets parameter name set to boolean true end end

----< E X P O R T S >

return {	styles_t = styles_t,														-- TODO: replace with styles.css infobox_career_params_t = infobox_career_params_t,							-- infobox ship line items infobox_characteristics_params_t = infobox_characteristics_params_t, infobox_class_overview_params_t = infobox_class_overview_params_t, infobox_ship_service_record_params_t = infobox_ship_service_record_params_t, warn_code_style = warn_code_style,											-- for preview warning messages warning_fmt_str = warning_fmt_str, warn_span_style = warn_span_style,

known_infobox_ship_params_t = known_infobox_ship_params_t,					-- for detecting unknown parameters known_infobox_ship_image_params_t = known_infobox_ship_image_params_t, known_infobox_ship_career_params_t = known_infobox_ship_career_params_t, known_infobox_ship_characteristics_params_t = known_infobox_ship_characteristics_params_t, known_infobox_ship_class_overview_params_t = known_infobox_ship_class_overview_params_t, known_infobox_ship_service_record_params_t = known_infobox_ship_service_record_params_t }