Difference between revisions of "Module:NVR/doc"
blackwiki>RP88 (ServiceShip -> ServiceCraft) |
blackwiki>RP88 (module's been in use for a month) |
||
| Line 1: | Line 1: | ||
{{ml|NVR|sandbox=NVR/sandbox}} | {{ml|NVR|sandbox=NVR/sandbox}} | ||
| − | {{Module rating | | + | {{Module rating |release <!-- Values: pre-alpha • alpha • beta • release • protected -- If a rating not needed/relevant, delete this template call -->}} |
<!-- 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__ | ||
Revision as of 20:09, 3 December 2016
{{#invoke:NVR|function}}
| This module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
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|DDG_1000}}produces http://www.nvr.navy.mil/SHIPDETAILS/SHIPSDETAIL_DDG_1000.HTML{{#invoke:NVR|MakeShipLink|OLDIRON}}produces malformed hull classification symbol: OLDIRON (help){{#invoke:NVR|MakeShipLink|OLDIRON|USS ''Constitution''}}produces malformed hull classification symbol: OLDIRON (help)
MakeServiceCraftLink
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:
- 1 or id — The 'file name' portion of the url path (typically the craft's hull designation) without the .HTM/.HTML extension.
- 2 or title — A title or label for the link.
Example:
{{#invoke:NVR|MakeServiceCraftLink|AFDB1_1}}produces unable to find hull classification symbol: ['AFDB-1_1'] in Module:NVR/data nvr_srv_craft_id (help)
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.
Examples:
link_string = nvr._MakeShipLink('DDG_1000', '')link_string = nvr._MakeShipLink('OLDIRON', '')
_MakeServiceCraftLink
This function returns a link to a service craft in the Naval Vessel Register.
Usage:
link_string = nvr._MakeServiceCraftLink(nvrid, title)
Parameters:
- nvrid — The 'file name' portion of the url path (typically the craft'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._MakeServiceCraftLink('AFDB1_1', '')