Template:Nasal doc: Difference between revisions
Jump to navigation
Jump to search
Red Leader (talk | contribs) m (Undo revision 80834 by Red Leader (talk)) |
Red Leader (talk | contribs) (doc interals) |
||
Line 32: | Line 32: | ||
== Usage == | == Usage == | ||
{{obr}}'''Nasal doc''' | |||
{{!}} ''name'' = | |||
{{!}} ''syntax'' = <nowiki><syntaxhighlight lang="nasal"></syntaxhighlight></nowiki> | |||
{{!}} ''heading'' = | |||
{{!}} ''source'' = | |||
{{!}} ''line'' = | |||
{{!}} ''version'' = | |||
{{!}} ''text'' = | |||
{{!}} ''param1'' = | |||
... | ... | ||
{{!}} ''param10'' = | |||
{{!}} ''param1text'' = | |||
... | ... | ||
{{!}} ''param10text'' = | |||
{{!}} ''example1text'' = | |||
{{!}} ''example1'' = <nowiki><syntaxhighlight lang="nasal"></syntaxhighlight></nowiki> | |||
... | ... | ||
{{!}} ''example10text'' = | |||
{{!}} ''example10'' = <nowiki><syntaxhighlight lang="nasal"></syntaxhighlight></nowiki> | |||
{{cbr}} | |||
All parameters are optional. | All parameters are optional. | ||
Line 63: | Line 63: | ||
; heading: Heading level, in wiki syntax. Defaults to 2nd level heading | ; heading: Heading level, in wiki syntax. Defaults to 2nd level heading | ||
; source: Flag for the source code link. Can be ''core,'' ''ext,'' or a URL to another site. ''core'' will link to | ; source: Flag for the source code link. Can be ''core,'' ''ext,'' or a URL to another site. ''core'' will link to {{repo link|site=s|proj=flightgear/simgear|path=simgear/nasal/lib.c}}, while ''ext'' links to {{repo link|site=s|proj=flightgear/flightgear|path=src/Scripting/NasalSys.cxx}}. Will be displayed in a table along with '''version'''. | ||
; line: Line to link to. Used with '''source'''. | ; line: Line to link to. Used with '''source'''. | ||
Line 81: | Line 81: | ||
== Example == | == Example == | ||
{{obr}}'''Nasal doc''' | |||
{{!}} name = function | |||
<nowiki> | {{!}} syntax = <nowiki><syntaxhighlight lang="nasal">function(a, [b, c]);</syntaxhighlight></nowiki> | ||
{{!}} heading = === | |||
{{!}} version = 3.2+ | |||
{{!}} text = Returns a value or <nowiki><code>'''nil'''</code></nowiki>. | |||
{{!}} param1 = a | |||
{{!}} param1text = Mandatory argument. | |||
{{!}} param2 = b | |||
{{!}} param2text = Optional argument. | |||
{{!}} param3 = c | |||
{{!}} param3text = Optional argument. | |||
<nowiki> | {{!}} example1 = <nowiki><syntaxhighlight lang="nasal">var variable = function("string");</syntaxhighlight></nowiki> | ||
<nowiki> | {{!}} example2 = <nowiki><syntaxhighlight lang="nasal">var variable = function("string", 1.234, FlightGear);</syntaxhighlight></nowiki> | ||
{{cbr}} | |||
{{Nasal doc | {{Nasal doc | ||
Line 116: | Line 116: | ||
<br/> | <br/> | ||
You don't have to give examples (although they are encouraged). | You don't have to give examples (although they are encouraged). | ||
{{obr}}'''Nasal doc''' | |||
{{!}} name = function2 | |||
{{!}} syntax = | |||
<syntaxhighlight lang="nasal">function2();</syntaxhighlight></nowiki> | <nowiki><syntaxhighlight lang="nasal">function2();</syntaxhighlight></nowiki> | ||
{{!}} text = Returns "Hello world!". | |||
{{cbr}} | |||
{{Nasal doc | {{Nasal doc | ||
Line 127: | Line 127: | ||
| syntax = | | syntax = | ||
<syntaxhighlight lang="nasal">function2();</syntaxhighlight> | <syntaxhighlight lang="nasal">function2();</syntaxhighlight> | ||
| text = Returns | | text = Returns "Hello world!". | ||
}} | }} | ||
Revision as of 10:16, 21 May 2015
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> | heading = | source = | line = | version = | text = | param1 = ... | param10 = | param1text = ... | param10text = | example1text = | example1 = <syntaxhighlight lang="nasal"></syntaxhighlight> ... | example10text = | example10 = <syntaxhighlight lang="nasal"></syntaxhighlight> }}
All parameters are optional.
Basic data
- name
- Name of the function (for example maketimer).
- syntax
- Syntax of the function.
- Note Please use <syntaxhighlight> tags.
- heading
- Heading level, in wiki syntax. Defaults to 2nd level heading
- source
- Flag for the source code link. Can be core, ext, or a URL to another site. core will link to flightgear/simgear/flightgear/next/simgear/nasal/lib.c, while ext links to flightgear/flightgear/flightgear/next/src/Scripting/NasalSys.cxx. Will be displayed in a table along with version.
- line
- Line to link to. Used with source.
- version
- Optional version statement, which will use {{FG ver}}.
- 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)text
- Description of the example. There can be up to ten of these, from example1text to example10text.
- example(n)
- Examples of the usage of the function. There can be up to ten examples, from example1 to example10.
- Note Please use <syntaxhighlight> tags.
Example
{{Nasal doc | name = function | syntax = <syntaxhighlight lang="nasal">function(a, [b, c]);</syntaxhighlight> | heading = === | version = 3.2+ | text = Returns a value or <code>'''nil'''</code>. | 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]);
Template:Nasal doc/table
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);
You don't have to give examples (although they are encouraged).
{{Nasal doc | name = function2 | syntax = <syntaxhighlight lang="nasal">function2();</syntaxhighlight> | text = Returns "Hello world!". }}
function2()
function2();
Template:Nasal doc/table Returns "Hello world!".
Known issues
- You have to manually add the
<syntaxhighlight>
tags.