Difference between revisions of "Module:NVR/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>RP88
(add links for test cases, etc.)
blackwiki>RP88
(eliminate id param)
Line 1: Line 1:
{{ml|NVR|sandbox=NVR/sandbox}}
 
{{Module rating |alpha<!-- 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]]) -->
 
 
__NOTOC__
 
__NOTOC__
 
== Summary ==
 
== Summary ==
Line 15: Line 12:
  
 
Usage:
 
Usage:
: <code><nowiki>{{#invoke:NVR|MakeShipLink|id=|title=}}</nowiki></code>
+
: <code><nowiki>{{#invoke:NVR|MakeShipLink|1=|title=}}</nowiki></code>
 
: <code><nowiki>{{#invoke:NVR|MakeShipLink}}</nowiki></code>
 
: <code><nowiki>{{#invoke:NVR|MakeShipLink}}</nowiki></code>
  
 
Parameters:
 
Parameters:
: '''1''' or '''id''' — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension.  
+
: '''1''' — 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.
 
   
 
   
Line 30: Line 27:
  
 
Usage:
 
Usage:
: <code><nowiki>{{#invoke:NVR|MakeServiceShipLink|id=|title=}}</nowiki></code>
+
: <code><nowiki>{{#invoke:NVR|MakeServiceShipLink|1=|title=}}</nowiki></code>
 
: <code><nowiki>{{#invoke:NVR|MakeServiceShipLink}}</nowiki></code>
 
: <code><nowiki>{{#invoke:NVR|MakeServiceShipLink}}</nowiki></code>
  
 
Parameters:
 
Parameters:
: '''1''' or '''id''' — The 'file name' portion of the url path (typically the ship's hull designation) without the .HTM/.HTML extension.  
+
: '''1''' — 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.
 
   
 
   
Line 76: Line 73:
 
* [[Template:NVR url]]
 
* [[Template:NVR url]]
 
* [[Template:NVR SC url]]
 
* [[Template:NVR SC url]]
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
 
}}</includeonly>
 

Revision as of 00:32, 28 September 2016

Summary

This module generates links to ships in the Naval Vessel Register (nvr.navy.mil) database. Intended to be used by:

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 — 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 — 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: The function "MakeServiceShipLink" does not exist.

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', '')

See Also