跳转到内容

模組:NVR/doc

本页使用了标题或全文手工转换
维基百科,自由的百科全书

这是Module:NVR/doc当前版本,由Tjmj留言 | 贡献编辑于2020年10月4日 (日) 11:24 (參照EN維基2017‎-09-05 18:37版本)。这个网址是本页该版本的固定链接。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)

这是Module:NVR的文档页面

Summary

[编辑]

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:NVR/data.

Using this module from templates

[编辑]
[编辑]

This function returns a link to a ship's page at the Naval Vessel Register website.

Usage:

{{#invoke:NVR|MakeShipLink|id=|title=}}
{{#invoke:NVR|MakeShipLink}} — uses the calling template's parameters

Parameters:

1 or id — the ship's case-insensitive hull classification symbol in one of five forms:
  1. SSBN-659 – the preferred format because it matches the format for hull classification symbols generally used for US Navy ships throughout Wikipedia
  2. SSBN 659
  3. SSBN659
  4. SSBN_659
  5. 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: “Constitution”号, “Maine”号ACR-1 (6), and “Texas”号1892 (6). 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:NVR|MakeShipLink|DDG_1000}} produces http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_1000.HTML
{{#invoke:NVR|MakeShipLink|constitution}} produces http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_1315.HTML
{{#invoke:NVR|MakeShipLink|maine|USS ''Maine''}} produces USS Maine
[编辑]

This function returns a link to a service craft in the Naval Vessel Register.

Usage:

{{#invoke:NVR|MakeServiceCraftLink|id=|title=}}
{{#invoke:NVR|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:
  1. YTB-760 – the preferred format because it matches the format for hull classification symbols generally used for US Navy ships throughout Wikipedia
  2. YTB 760
  3. YTB760
  4. YTB_760
  5. 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:NVR|MakeServiceCraftLink|AFDB-7F}} produces http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_AFDB_7_1549.HTML
{{#invoke:NVR|MakeServiceCraftLink|ytb-760}} produces Natick