Template:Func link: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Update from sandbox)
(Add pre for e.g., _cmdarg())
 
Line 2: Line 2:
| <span class="plainlinks"><code><!-- formatting
| <span class="plainlinks"><code><!-- formatting
-->{{#if: {{{link|}}} <!-- has link? -->
-->{{#if: {{{link|}}} <!-- has link? -->
   | [{{{link}}} {{{1}}}] <!-- yes -->
   | [{{{link}}} {{{pre|}}}{{{1}}}] <!-- yes -->
   | [[ <!-- no, start wiki link
   | [[ <!-- no, start wiki link


Line 20: Line 20:
   -->{{#if: {{{3|}}} | {{{3}}}. }}<!-- use class if given
   -->{{#if: {{{3|}}} | {{{3}}}. }}<!-- use class if given


   -->{{{1}}}<!-- finally, function name
   -->{{{pre|}}}{{{1}}}<!-- finally, function name


   -->]] <!-- close wiki link
   -->]] <!-- close wiki link
Line 35: Line 35:


== Usage ==
== Usage ==
  {{obr}}'''func link'''{{!}}api{{!}}''namespace''{{!}}''class''{{!}}''page=''{{!}}''link=''{{cbr}}
  {{obr}}'''func link'''{{!}}api{{!}}''namespace''{{!}}''class''{{!}}''page=''{{!}}''link=''{{!}}''pre=''{{cbr}}


All parameters except '''api''' are optional
All parameters except '''api''' are optional
Line 48: Line 48:


; link: External link to another site. Overrides '''page'''.
; link: External link to another site. Overrides '''page'''.
; pre: Text to prepend to the function's name in the link label. Can be used for an underscore, e.g., {{func link|cmdarg()|pre=_}}.


== Examples ==
== Examples ==

Latest revision as of 13:52, 16 November 2016

The following template description is not displayed when the template is inserted in an article.

Goal

This template can be used to add a link to the documentation of a Nasal API function. It can also be used for others (for example C++ functions) and can link to external sites.

Usage

{{func link|api|namespace|class|page=|link=|pre=}}

All parameters except api are optional

api
Name of the function to link to. Must include the brackets (()).
namespace
Optional namespace. Used when linking to the namespace documentation.
class
Optional class. Used in link label.
page
Link to another wiki page, for example Help:Template. If given as "this", the template will use the page the template is on.
link
External link to another site. Overrides page.
pre
Text to prepend to the function's name in the link label. Can be used for an underscore, e.g., _cmdarg() .

Examples

Link to namespace

See also {{func link|open()|io}}.

See also io.open() .

Link to namespace and class

{{func link|set_latlon()|geo|Coord}} is used to set coordinates.

geo.Coord.set_latlon() is used to set coordinates.

Link to external site

{{func link|printf()|link=http://en.wikipedia.org/wiki/Printf_format_string}}

printf()