Module:Naval Vessel Register URL/doc
Appearance
| This is a documentation subpage for Module:Naval Vessel Register URL. It may contain usage information, categories and other content that is not part of the original module page. |
{{#invoke:NVR|function}}
| This module is rated as alpha. It is ready for limited use and third-party feedback. It may be used on a small number of pages, but should be monitored closely. Suggestions for new features or adjustments to input and output are welcome. |
Summary
This module generates links to ships in the Naval Vessel Register (nvr.navy.mil) database. Intended to be used by:
- {{NVR url}}
- {{NVR SC url}}
The table of URL transformations used by this module can be found at Module:NVR/rules.
Using this module from templates
MakeShipLink
This function returns a link to a ship in the Naval Vessel Register.
Usage:
{{#invoke:NVR|MakeShipLink|id=|title=}}{{#invoke:NVR|MakeShipLink}}— uses the calling template's parameters
Parameters:
- 1 or id — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension.
- 2 or title — A title or label for the link.
Examples:
{{#invoke:NVR|MakeShipLink|OLDIRON}}produces Script error: No such module "NVR".{{#invoke:NVR|MakeShipLink|OLDIRON|USS ''Constitution''}}produces Script error: No such module "NVR".
MakeServiceShipLink
This function returns a link to a service ship in the Naval Vessel Register.
Usage:
{{#invoke:NVR|MakeServiceShipLink|id=|title=}}{{#invoke:NVR|MakeServiceShipLink}}— uses the calling template's parameters
Parameters:
- 1 or id — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension.
- 2 or title — A title or label for the link.
Example:
{{#invoke:NVR|MakeServiceShipLink|AFDB1_1}}produces Script error: No such module "NVR".
Using this module from Lua code
In order to use the functions in this module from another Lua module you first have to import this module.
Example:
local nvr = require('Module:NVR')
_MakeShipLink
This function returns a link to a ship in the Naval Vessel Register.
Usage:
link_string = nvr._MakeShipLink(nvrid, title)
Parameters:
- nvrid — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension, as a string.
- title — Title for link, set to
''for a bare link without a title.
Example:
link_string = nvr._MakeShipLink('OLDIRON', '')
_MakeServiceShipLink
This function returns a link to a service ship in the Naval Vessel Register.
Usage:
link_string = nvr._MakeServiceShipLink(nvrid, title)
Parameters:
- nvrid — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension, as a string.
- title — Title for link, set to
''for a bare link without a title.
Example:
link_string = nvr._MakeServiceShipLink('AFDB1_1', '')