Template:Nasal doc: Difference between revisions
Jump to navigation
Jump to search
Red Leader (talk | contribs) m (Template name) |
(Various tweaks: Parenthesis after function name, automatic plural form, slightly different doc style, more verbose doc, Template:Inote instead of template:Icaution, using two parameters for the two examples) |
||
Line 1: | Line 1: | ||
<includeonly>=== {{{name|function}}} === | <includeonly>=== {{{name|function}}}() === | ||
{{{syntax|}}} | {{{syntax|}}} | ||
{{{text|}}} | {{{text|}}} | ||
Line 12: | Line 12: | ||
;{{{param9|}}}:{{{param9text|}}} | ;{{{param9|}}}:{{{param9text|}}} | ||
;{{{param10|}}}:{{{param10text|}}} | ;{{{param10|}}}:{{{param10text|}}} | ||
'''Example | '''Example{{#if: {{{example2|}}}{{{example3|}}}{{{example4|}}}{{{example5|}}}{{{example6|}}}{{{example7|}}}{{{example8|}}}{{{example9|}}}{{{example10|}}}|s}}''' | ||
{{{example1|}}}{{{example2|}}}{{{example3|}}}{{{example4|}}}{{{example5|}}}{{{example6|}}}{{{example7|}}}{{{example8|}}}{{{example9|}}}{{{example10|}}}</includeonly><noinclude> | {{{example1|}}}{{{example2|}}}{{{example3|}}}{{{example4|}}}{{{example5|}}}{{{example6|}}}{{{example7|}}}{{{example8|}}}{{{example9|}}}{{{example10|}}}</includeonly><noinclude> | ||
{{Informative template|1= | {{Informative template|1= | ||
__NOTOC__ | __NOTOC__ | ||
== Goal == | == Goal == | ||
This template is to be used to document [[Nasal]] API functions. The | This template is to be used to document [[Nasal]] API functions. The underlying aim is to unify Nasal documentation on the wiki. | ||
== Usage == | == Usage == | ||
<nowiki>{{</nowiki>'''Nasal doc''' | <nowiki>{{</nowiki>'''Nasal doc''' | ||
<nowiki>|</nowiki> ''name'' | <nowiki>|</nowiki> ''name'' = | ||
<nowiki>|</nowiki> ''syntax'' | <nowiki>|</nowiki> ''syntax'' = <nowiki><syntaxhighlight lang="nasal"></syntaxhighlight></nowiki> | ||
<nowiki>|</nowiki> ''text'' | <nowiki>|</nowiki> ''text'' = | ||
<nowiki>|</nowiki> ''param1 ... | <nowiki>|</nowiki> ''param1'' = | ||
<nowiki>|</nowiki> ''param1text ... param10text'' = | ... | ||
<nowiki>|</nowiki> ''example1 ... example10'' | <nowiki>|</nowiki> ''param10'' = | ||
<nowiki>|</nowiki> ''param1text'' = | |||
... | |||
<nowiki>|</nowiki> ''param10text'' = | |||
<nowiki>|</nowiki> ''example1'' = <nowiki><syntaxhighlight lang="nasal"></syntaxhighlight></nowiki> | |||
... | |||
<nowiki>|</nowiki> ''example10'' = <nowiki><syntaxhighlight lang="nasal"></syntaxhighlight></nowiki> | |||
<nowiki>}}</nowiki> | <nowiki>}}</nowiki> | ||
Line 32: | Line 38: | ||
=== Basic data === | === Basic data === | ||
; name: Name of function ( | ; name: Name of function (for example '''maketimer'''). | ||
; syntax: | ; syntax: Syntax of function. | ||
: {{inote|Please use <nowiki><syntaxhighlight lang="nasal"/></nowiki> tags.}} | |||
; text: | ; text: Description of the function. | ||
; | ; param(n): Names of the parameters of the function. There can be up to ten parameters, from '''param1''' to '''param10'''. | ||
; | ; param(n)text: Description of the parameters. There can be up to ten parameters, from '''param1text''' to '''param10text'''. | ||
; | ; example(n): Examples of the use of the function. There can be up to ten examples, from '''example1''' to '''example10'''. | ||
: {{inote|Please use <nowiki><syntaxhighlight lang="nasal"/></nowiki> tags.}} | |||
== Example == | == Example == | ||
<nowiki>{{</nowiki>'''Nasal doc''' | <nowiki>{{</nowiki>'''Nasal doc''' | ||
<nowiki>|</nowiki>name = function | <nowiki>|</nowiki> name = function | ||
<nowiki>|syntax = <syntaxhighlight lang="nasal">function(a, [b, c]);</syntaxhighlight></nowiki> | <nowiki>| syntax = | ||
<nowiki>|text = Returns a value or '''nil'''.</nowiki> | <syntaxhighlight lang="nasal">function(a, [b, c]);</syntaxhighlight></nowiki> | ||
<nowiki>|</nowiki>param1 = a | <nowiki>| text = Returns a value or '''nil'''.</nowiki> | ||
<nowiki>|</nowiki>param1text = Mandatory argument. | <nowiki>|</nowiki> param1 = a | ||
<nowiki>|</nowiki>param2 = b | <nowiki>|</nowiki> param1text = Mandatory argument. | ||
<nowiki>|</nowiki>param2text = Optional argument. | <nowiki>|</nowiki> param2 = b | ||
<nowiki>|</nowiki>param3 = c | <nowiki>|</nowiki> param2text = Optional argument. | ||
<nowiki>|</nowiki>param3text = Optional argument. | <nowiki>|</nowiki> param3 = c | ||
<nowiki>|example1 = <syntaxhighlight lang="nasal">var variable = function("string");</syntaxhighlight> | <nowiki>|</nowiki> param3text = Optional argument. | ||
<nowiki>| example1 = | |||
<syntaxhighlight lang="nasal">var variable = function("string");</syntaxhighlight></nowiki> | |||
<nowiki>| example2 = | |||
<syntaxhighlight lang="nasal">var variable = function("string", 1.234, FlightGear);</syntaxhighlight></nowiki> | <syntaxhighlight lang="nasal">var variable = function("string", 1.234, FlightGear);</syntaxhighlight></nowiki> | ||
<nowiki>}}</nowiki> | <nowiki>}}</nowiki> | ||
{{Nasal doc | {{Nasal doc | ||
|name = function | | name = function | ||
|syntax = <syntaxhighlight lang="nasal">function(a, [b, c]);</syntaxhighlight> | | syntax = | ||
|text = Returns a value or '''nil'''. | <syntaxhighlight lang="nasal">function(a, [b, c]);</syntaxhighlight> | ||
|param1 = a | | text = Returns a value or '''nil'''. | ||
|param1text = Mandatory argument. | | param1 = a | ||
|param2 = b | | param1text = Mandatory argument. | ||
|param2text = Optional argument. | | param2 = b | ||
|param3 = c | | param2text = Optional argument. | ||
|param3text = Optional argument. | | param3 = c | ||
|example1 = <syntaxhighlight lang="nasal">var variable = function("string");</syntaxhighlight> | | param3text = Optional argument. | ||
| example1 = | |||
<syntaxhighlight lang="nasal">var variable = function("string");</syntaxhighlight> | |||
| example2 = | |||
<syntaxhighlight lang="nasal">var variable = function("string", 1.234, FlightGear);</syntaxhighlight> | <syntaxhighlight lang="nasal">var variable = function("string", 1.234, FlightGear);</syntaxhighlight> | ||
}} | }} |
Revision as of 21:11, 20 November 2014
The following template description is not displayed when the template is inserted in an article.
Goal
This template is to be used to document Nasal API functions. The underlying aim is to unify Nasal documentation on the wiki.
Usage
{{Nasal doc | name = | syntax = <syntaxhighlight lang="nasal"></syntaxhighlight> | text = | param1 = ... | param10 = | param1text = ... | param10text = | example1 = <syntaxhighlight lang="nasal"></syntaxhighlight> ... | example10 = <syntaxhighlight lang="nasal"></syntaxhighlight> }}
All parameters are optional.
Basic data
- name
- Name of function (for example maketimer).
- syntax
- Syntax of function.
- Note Please use <syntaxhighlight lang="nasal"/> tags.
- text
- Description of the function.
- param(n)
- Names of the parameters of the function. There can be up to ten parameters, from param1 to param10.
- param(n)text
- Description of the parameters. There can be up to ten parameters, from param1text to param10text.
- example(n)
- Examples of the use of the function. There can be up to ten examples, from example1 to example10.
- Note Please use <syntaxhighlight lang="nasal"/> tags.
Example
{{Nasal doc | name = function | syntax = <syntaxhighlight lang="nasal">function(a, [b, c]);</syntaxhighlight> | text = Returns a value or '''nil'''. | param1 = a | param1text = Mandatory argument. | param2 = b | param2text = Optional argument. | param3 = c | param3text = Optional argument. | example1 = <syntaxhighlight lang="nasal">var variable = function("string");</syntaxhighlight> | example2 = <syntaxhighlight lang="nasal">var variable = function("string", 1.234, FlightGear);</syntaxhighlight> }}
function()
function(a, [b, c]);
Returns a value or nil.
- a
- Mandatory argument.
- b
- Optional argument.
- c
- Optional argument.
Examples
var variable = function("string");
var variable = function("string", 1.234, FlightGear);
Known issues
You have to manually input <syntaxhighlight lang="nasal"/>.