Module:Infobox ship/data
--[[--------------------------< W A R N I N G M E S S A G E S >----------------------------------------------
These styles cannot be moved to Module:Infobox ship/style.css because mw.addWarning() does not understand or apply css
]]
local warn_span_style = 'color:#bf3c2c';
local warn_code_style = 'color: inherit; background: inherit; border: none; padding: inherit;';
local warning_fmt_str = '<span style="%s"><code style="%s">{{[[Template:%s|%s]]}}</code>: unknown parameter: <code style="%s">|%s=%s</code></span>';
local image_EIS_warning_fmt_str = '<span style="%s"><code style="%s">{{[[Template:%s|%s]]}}</code>: uses [[Wikipedia:Extended image syntax|Extended image syntax]]</span>';
local image_size_warning_fmt_str = '<span style="%s"><code style="%s">{{[[Template:%s|%s]]}}</code>: specifies default image size</span>';
local image_missing_warning_fmt_str = '<span style="%s"><code style="%s">{{[[Template:%s|%s]]}}</code>: <code style="%s">|image_caption=</code> and <code style="%s">|image_alt=</code> require <code style="%s">|image=</code></span>';
--[[--------------------------< E R R O R _ M E S S A G E S >--------------------------------------------------
]]
local error_messages_t = {
missing_section = '<span class="error ib-ship-error">missing <span class="ib-ship-code">|section\'\'n\'\'=</span> parameter in <span class="ib-ship-code">|section%s=</span></span>', -- %s is |sectionn= (|datan=) enumerator
positional = '<span class="error ib-ship-error">positional parameters not supported</span>', -- categorized in the unknown parameter category (because in '|{{infobox ship/...}}' the positional param is not known)
}
--[[--------------------------< C A T E G O R I E S >----------------------------------------------------------
]]
local categories_t = {
no_image = '[[Category:Ship infoboxes without an image]]', -- warning categories
image_syntax = '[[Category:Infobox ship/image syntax]]',
unknown = '[[Category:Pages using infobox ship with unknown parameters]]',
missing_section = '[[Category:Ship infoboxes missing section parameter]]',
non_std_img_size = '[[Category:Infobox ship with non-standard image size]]',-- not a warning category
}
--[[--------------------------< 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
{'name', 'Name'},
{'namesake', 'Namesake'},
{'owner', 'Owner'},
{'operator', 'Operator'},
{'registry', 'Port of registry'},
{'route', 'Route'},
{'ordered', 'Ordered'},
{'awarded', 'Awarded'},
{'builder', 'Builder'},
{'original_cost', 'Cost'},
{'yard_number', 'Yard number'},
{'way_number', 'Way number'},
{'laid_down', 'Laid down'},
{'launched', 'Launched'},
{'sponsor', 'Sponsored by'},
{'christened', 'Christened'},
{'completed', 'Completed'},
{'acquired', 'Acquired'},
{'commissioned', 'Commissioned'},
{'recommissioned', 'Recommissioned'},
{'decommissioned', 'Decommissioned'},
{'maiden_voyage', 'Maiden voyage'},
{'in_service', 'In service'},
{'out_of_service', 'Out of service'},
{'renamed', 'Renamed'},
{'reclassified', 'Reclassified'},
{'refit', 'Refit'},
{'struck', 'Stricken'},
{'stricken', 'Stricken'},
{'reinstated', 'Reinstated'},
{'homeport', 'Home port'},
{'identification', 'Identification'},
{'motto', 'Motto'},
{'nickname', 'Nickname(s)'},
{'honours', 'Honours and<br />awards'}, -- uk spelling
{'honors', 'Honors and<br />awards'},
{'captured', 'Captured'},
{'fate', 'Fate'},
{'status', 'Status'},
{'notes', 'Notes'},
{'badge', 'Badge'},
}
local infobox_characteristics_params_t = { -- table of parameters that are rendered in the same way
{'class', 'Class & type'},
{'type', 'Type'},
{'tonnage', 'Tonnage'},
{'displacement', 'Displacement'},
{'tons_burthen', 'Tons burthen'},
{'length', 'Length'},
{'beam', 'Beam'},
{'height', 'Height'},
{'draught', 'Draught'}, -- uk spelling
{'draft', 'Draft'},
{'depth', 'Depth'},
{'hold_depth', 'Depth of hold'},
{'decks', 'Decks'},
{'deck_clearance', 'Deck clearance'},
{'ramps', 'Ramps'},
{'ice_class', 'Ice class'},
{'power', 'Installed power'},
{'propulsion', 'Propulsion'},
{'sail_plan', 'Sail plan'},
{'speed', 'Speed'},
{'range', 'Range'},
{'endurance', 'Endurance'},
{'test_depth', 'Test depth'},
{'boats', 'Boats & landing<br />craft carried'},
{'capacity', 'Capacity'},
{'troops', 'Troops'},
{'complement', 'Complement'},
{'crew', 'Crew'},
{'time_to_activate', 'Time to activate'},
{'sensors', 'Sensors &<br />processing systems'},
{'EW', 'Electronic warfare<br />& decoys'},
{'armament', 'Armament'},
{'armour', 'Armour'}, -- uk spelling
{'armor', 'Armor'},
{'aircraft', 'Aircraft carried'},
{'aircraft_facilities', 'Aviation facilities'},
{'notes', 'Notes'},
}
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'}, -- uk spelling
{'total_ships_canceled', 'Canceled'},
{'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 {{Infobox ship}}
['data#'] = true, -- these native to infobox ship
['label#'] = true,
['section#'] = true,
display_title = true, -- these inherited from obsolete {{infobox ship begin}}
infobox_caption = true,
sclass = true,
showerrs = true,
}
local known_infobox_ship_image_params_t = { -- all parameters known to {{Infobox ship/image}}
child = true, -- |child= defaults to 'yes'; set to 'no' for standalone
infobox_caption = true, -- only valid when |child=no (stand-alone mode)
image = true,
image_alt = true,
image_size = true,
image_caption = true,
}
local known_infobox_ship_career_params_t = { -- non-line-item parameters known to {{Infobox ship/career}}
child = true, -- |child= defaults to 'yes'; set to 'no' for standalone
infobox_caption = true, -- this one only valid when |child=no (stand-alone mode)
hide_header = true,
country = true,
flag = true,
}
local known_infobox_ship_characteristics_params_t = { -- non-line-item parameters known to {{Infobox ship/characteristics}}
child = true, -- |child= defaults to 'yes'; set to 'no' for standalone
infobox_caption = true, -- this one only valid when |child=no (stand-alone mode)
header_caption = true,
hide_header = true,
}
local known_infobox_ship_class_overview_params_t = { -- non-line-item parameters known to {{Infobox ship/class}}
child = true, -- |child= defaults to 'yes'; set to 'no' for standalone
infobox_caption = true, -- this one only valid when |child=no (stand-alone mode)
hide_header = true,
}
local known_infobox_ship_service_record_params_t = { -- non-line-item parameters known to {{Infobox ship/service record}}
child = true, -- |child= defaults to 'yes'; set to 'no' for standalone
infobox_caption = true, -- this one only valid when |child=no (stand-alone mode)
header_caption = true,
hide_header = true,
label = true, -- deprecated alias of |header_caption=
}
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 -- <line_t> 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 >----------------------------------------------------------------
]]
local namespace_number = mw.title.getCurrentTitle().namespace; -- get article namespace for categorization
return
{
cat_this_namespace = (0 == namespace_number) or (118 == namespace_number), -- only categorize in these namespaces (article, draft)
stripmarker = '\127[^\127]*UNIQ%-%-%a+%-%x+%-QINU[^\127]*\127', -- used to supress stripmarkers in preview warning messages
namespace_number = namespace_number, -- article namespace number
namespace_name = mw.title.getCurrentTitle().nsText:gsub ('_', ' '); -- article namespace name
categories_t = categories_t,
error_messages_t = error_messages_t,
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; preview warning messages do not support css
warn_span_style = warn_span_style,
warning_fmt_str = warning_fmt_str, -- unknown parameter
image_warning_fmt_str = image_warning_fmt_str,
image_EIS_warning_fmt_str = image_EIS_warning_fmt_str,
image_size_warning_fmt_str = image_size_warning_fmt_str,
image_missing_warning_fmt_str =image_missing_warning_fmt_str,
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,
templatestyles = 'Module:Infobox ship/styles.css'
}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.