Difference between revisions of "Module:NVR/doc"
Jump to navigation
Jump to search
blackwiki>RP88 (→Using this module from templates: add example) |
blackwiki>RP88 (update docs) |
||
| Line 19: | Line 19: | ||
Parameters: | Parameters: | ||
| − | : '''1''' — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension. | + | : '''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. | : '''2''' or '''title''' — A title or label for the link. | ||
| − | + | Example: | |
: <code><nowiki>{{#invoke:NVR|MakeShipLink|OLDIRON}}</nowiki></code> produces {{#invoke:NVR|MakeShipLink|OLDIRON}} | : <code><nowiki>{{#invoke:NVR|MakeShipLink|OLDIRON}}</nowiki></code> produces {{#invoke:NVR|MakeShipLink|OLDIRON}} | ||
| − | |||
=== MakeServiceShipLink === | === MakeServiceShipLink === | ||
| Line 35: | Line 34: | ||
Parameters: | Parameters: | ||
| − | : '''1''' — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension. | + | : '''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. | : '''2''' or '''title''' — A title or label for the link. | ||
| − | + | Examples: | |
| − | : <code><nowiki>{{#invoke:NVR| | + | : <code><nowiki>{{#invoke:NVR|MakeShipLink|OLDIRON}}</nowiki></code> produces {{#invoke:NVR|MakeShipLink|OLDIRON}} |
| + | : <code><nowiki>{{#invoke:NVR|MakeShipLink|OLDIRON|USS ''Constitution''}}</nowiki></code> produces {{#invoke:NVR|MakeShipLink|OLDIRON|USS ''Constitution''}} | ||
== Using this module from Lua code == | == Using this module from Lua code == | ||
Revision as of 02:49, 28 September 2016
{{#invoke:NVR|function}}
| 26x26px | This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms 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}}
Using this module from templates
MakeShipLink
This function returns a link to a ship in the Naval Vessel Register.
Usage:
{{#invoke:NVR|MakeShipLink|1=|title=}}{{#invoke:NVR|MakeShipLink}}
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|MakeShipLink|OLDIRON}}produces malformed hull classification symbol: OLDIRON (help)
MakeServiceShipLink
This function returns a link to a service ship in the Naval Vessel Register.
Usage:
{{#invoke:NVR|MakeServiceShipLink|1=|title=}}{{#invoke:NVR|MakeServiceShipLink}}
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 malformed hull classification symbol: OLDIRON (help){{#invoke:NVR|MakeShipLink|OLDIRON|USS ''Constitution''}}produces malformed hull classification symbol: OLDIRON (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.
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', '')