Module:Naval Vessel Register URL/doc: Difference between revisions
m Pppery moved page Module:NVR/doc to Module:Naval Vessel Register URL/doc |
Post-move cleanup |
||
Line 1: | Line 1: | ||
{{User:RMCD bot/subject notice|1=Module:Naval Vessel Register URL|2=Template talk:NVR url#Requested move 7 October 2020 }} |
|||
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> |
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> |
||
__NOTOC__ |
__NOTOC__ |
||
== Summary == |
== Summary == |
||
This module generates links to ships in the Naval Vessel Register (nvr.navy.mil) database. Intended to be used by: |
This module generates links to ships in the Naval Vessel Register (nvr.navy.mil) database. Intended to be used by: |
||
*{{tlx| |
*{{tlx|Naval Vessel Register URL}} |
||
*{{tlx| |
*{{tlx|Naval Vessel Register service craft URL}} |
||
NVR have adopted a file naming convention based on a ship's [[hull classification symbol]] with an appended underscore and some number of digits. The extra digits do not seem to follow an identifiable pattern so the former rules-based system used here no longer works. |
NVR have adopted a file naming convention based on a ship's [[hull classification symbol]] with an appended underscore and some number of digits. The extra digits do not seem to follow an identifiable pattern so the former rules-based system used here no longer works. |
||
To get round the 'new' file format, this version of the module adopts a brute-force mechanism by using a local database that maps a ship's hull classification symbol to its associated NVR file name. The database is two large Lua tables maintained at [[Module: |
To get round the 'new' file format, this version of the module adopts a brute-force mechanism by using a local database that maps a ship's hull classification symbol to its associated NVR file name. The database is two large Lua tables maintained at [[Module:Naval Vessel Register URL/data]]. |
||
== Using this module from templates == |
== Using this module from templates == |
||
Line 18: | Line 17: | ||
Usage: |
Usage: |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeShipLink|id=|title=}}</nowiki></code> |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeShipLink}}</nowiki></code> — uses the calling template's parameters |
||
Parameters: |
Parameters: |
||
Line 32: | Line 31: | ||
Examples: |
Examples: |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeShipLink|DDG_1000}}</nowiki></code> produces {{#invoke:Naval Vessel Register URL|MakeShipLink|DDG_1000}} |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeShipLink|constitution}}</nowiki></code> produces {{#invoke:Naval Vessel Register URL|MakeShipLink|constitution}} |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeShipLink|maine|USS ''Maine''}}</nowiki></code> produces {{#invoke:Naval Vessel Register URL|MakeShipLink|maine|USS ''Maine''}} |
||
=== MakeServiceCraftLink === |
=== MakeServiceCraftLink === |
||
Line 41: | Line 40: | ||
Usage: |
Usage: |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|id=|title=}}</nowiki></code> |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink}}</nowiki></code> — uses the calling template's parameters |
||
Parameters: |
Parameters: |
||
Line 55: | Line 54: | ||
: '''2''' or '''title''' — A title or label for the link. |
: '''2''' or '''title''' — A title or label for the link. |
||
Examples: |
Examples: |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|AFDB-7F}}</nowiki></code> produces {{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|AFDB7F}} |
||
: <code><nowiki>{{#invoke: |
: <code><nowiki>{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|ytb-760}}</nowiki></code> produces {{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|ytb-760|''Natick''}} |
Latest revision as of 19:53, 22 October 2020
Summary
[edit]This module generates links to ships in the Naval Vessel Register (nvr.navy.mil) database. Intended to be used by:
NVR have adopted a file naming convention based on a ship's hull classification symbol with an appended underscore and some number of digits. The extra digits do not seem to follow an identifiable pattern so the former rules-based system used here no longer works.
To get round the 'new' file format, this version of the module adopts a brute-force mechanism by using a local database that maps a ship's hull classification symbol to its associated NVR file name. The database is two large Lua tables maintained at Module:Naval Vessel Register URL/data.
Using this module from templates
[edit]MakeShipLink
[edit]This function returns a link to a ship's page at the Naval Vessel Register website.
Usage:
{{#invoke:Naval Vessel Register URL|MakeShipLink|id=|title=}}
{{#invoke:Naval Vessel Register URL|MakeShipLink}}
— uses the calling template's parameters
Parameters:
- 1 or id — the ship's case-insensitive hull classification symbol in one of five forms:
- SSBN-659 – the preferred format because it matches the format for hull classification symbols generally used for US Navy ships throughout Wikipedia
- SSBN 659
- SSBN659
- SSBN_659
- SSBN_659_1635 – the NVR file name format as of September 2017
- There are exceptions. There are three ships listed at the NVR website that do not have hull classification symbols. These are: USS Constitution, USS Maine, and USS Texas. For these three ships, use the ship's name for this parameter. The code word OLDIRON, previously used to identify Constitution is no longer supported.
- 2 or title — A title or label for the link.
Examples:
{{#invoke:Naval Vessel Register URL|MakeShipLink|DDG_1000}}
produces http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_1000.HTML{{#invoke:Naval Vessel Register URL|MakeShipLink|constitution}}
produces http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML{{#invoke:Naval Vessel Register URL|MakeShipLink|maine|USS ''Maine''}}
produces USS Maine
MakeServiceCraftLink
[edit]This function returns a link to a service craft in the Naval Vessel Register.
Usage:
{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|id=|title=}}
{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink}}
— uses the calling template's parameters
Parameters: Parameters:
- 1 or id — the ship's case-insensitive hull classification symbol in one of five forms:
- YTB-760 – the preferred format because it matches the format for hull classification symbols generally used for US Navy ships throughout Wikipedia
- YTB 760
- YTB760
- YTB_760
- YTB_760_5292 – the NVR file name format as of September 2017
- There are exceptions. NVR has separate pages for some single and some multiple sections of some floating drydocks. For these, this module adopts a convention similarly used by NVR where each section is distinguished by a letter designator; that letter must be appended to the hull classification symbol used in this parameter; see the examples
- 2 or title — A title or label for the link.
Examples:
{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|AFDB-7F}}
produces http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_7_1549.HTML{{#invoke:Naval Vessel Register URL|MakeServiceCraftLink|ytb-760}}
produces Natick