Template:Func link: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Link to Nasal library)
(Add pre for e.g., _cmdarg())
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly>{{#if: {{{1|}}} <!-- has argument -->
| <span class="plainlinks"><code><!-- formatting
-->{{#if: {{{link|}}} <!-- has link? -->
  | [{{{link}}} {{{pre|}}}{{{1}}}] <!-- yes -->
  | [[ <!-- no, start wiki link


--><span class="plainlinks"><code><!-- Extra formatting
  -->{{#if: {{{page|}}} <!-- has page -->
    | {{#ifeq: {{{page}}} | this | {{FULLPAGENAME}} }}<!-- if page is "this", use page the template is on -->
    | Nasal library<!-- no, assume that it is in the doc
    -->{{#if: {{{2|}}} <!-- namespace given? -->
      | /{{{2}}}<!-- yes, link to it -->
      }}
    }}<!--


-->{{#if: {{{ext|}}} <!-- is an external link is supplied?
  -->#{{urlencode:{{{1}}}|WIKI}}<!-- encode in wiki link form


-->| [{{{ext}}} {{{1|<big style="color: red">Missing argument!</big>}}}]<!-- yes, so link to that
  -->|<!-- start link label


-->| {{#switch: {{{1|error}}} <!-- no, so use switch for pre-set APIs
  -->{{#if: {{{2|}}} | {{{2}}}. }}<!-- use namespace if given
-->| error = <big style="color: red">Missing argument!</big> <!-- error message -->
  -->{{#if: {{{3|}}} | {{{3}}}. }}<!-- use class if given
<!-- pre-made links for core library Nasal APIs below -->
| append
| append() = [[Nasal library#append.28.29|append()]]
| bind
| bind() = [[Nasal library#bind.28.29|bind()]]
| call
| call() = [[Nasal library#call.28.29|call()]]
| caller
| caller() = [[Nasal library#caller.28.29|caller()]]
| chr
| chr() = [[Nasal library#chr.28.29|chr()]]
| closure
| closure() = [[Nasal library#closure.28.29|closure()]]
| cmp
| cmp() = [[Nasal library#cmp.28.29|cmp()]]
| compile
| compile() = [[Nasal library#compile.28.29|compile()]]
| contains
| contains() = [[Nasal library#contains.28.29|contains()]]
| delete
| delete() = [[Nasal library#delete.28.29|delete()]]
| die
| die() = [[Nasal library#die.28.29|die()]]
| find
| find() = [[Nasal library#find.28.29|find()]]
| ghosttype
| ghosttype() = [[Nasal library#ghosttype.28.29|ghosttype()]]
| id
| id() = [[Nasal library#id.28.29|id()]]
| int
| int() = [[Nasal library#int.28.29|int()]]
| keys
| keys() = [[Nasal library#keys.28.29|keys()]]
| left
| left() = [[Nasal library#left.28.29|left()]]
| num
| num() = [[Nasal library#num.28.29|num()]]
| pop
| pop() = [[Nasal library#pop.28.29|pop()]]
| right
| right() = [[Nasal library#right.28.29|right()]]
| setsize
| setsize() = [[Nasal library#setsize.28.29|setsize()]]
| size
| size() = [[Nasal library#size.28.29|size()]]
| sort
| sort() = [[Nasal library#sort.28.29|sort()]]
| split
| split() = [[Nasal library#split.28.29|split()]]
| sprintf
| sprintf() = [[Nasal library#sprintf.28.29|sprintf()]]
| streq
| streq() = [[Nasal library#streq.28.29|streq()]]
| substr
| substr() = [[Nasal library#substr.28.29|substr()]]
| subvec
| subvec() = [[Nasal library#subvec.28.29|subvec()]]
| typeof
| typeof() = [[Nasal library#typeof.28.29|typeof()]]
<!-- extension functions -->
| cmdarg
| cmdarg() = [[Nasal library#cmdarg.28.29|cmdarg()]]
| fgcommand
| fgcommand() = [[Nasal library#fgcommand.28.29|fgcommand()]]
| addcommand
| addcommand() = [[Nasal library#addcommand.28.29|addcommand()]]
| removecommand
| removecommand() = [[Nasal library#removecommand.28.29|removecommand()]]
| print
| print() = [[Nasal library#print.28.29|print()]]
| logprint
| logprint() = [[Nasal library#logprint.28.29|logprint()]]
| getprop
| getprop() = [[Nasal library#getprop.28.29|getprop()]]
| setprop
| setprop() = [[Nasal library#setprop.28.29|setprop()]]
| interpolate
| interpolate() = [[Nasal library#interpolate.28.29|interpolate()]]
| settimer
| settimer() = [[Nasal library#settimer.28.29|settimer()]]
| maketimer
| maketimer() = [[Nasal library#maketimer.28.29_.282.11.2B.29|maketimer()]]
| geodinfo
| geodinfo() = [[Nasal library#geodinfo.28.29|geodinfo()]]
| airportinfo
| airportinfo() = [[Nasal library#airportinfo.28.29|airportinfo()]]
| history
| history() = [[Nasal library#history.28.29_.283.1.2B.29|history()]]
| flightplan
| flightplan() = [[Nasal library#flightplan.28.29|flightplan()]]
| carttogeod
| carttogeod() = [[Nasal library#carttogeod.28.29|carttogeod()]]
| geodtocart
| geodtocart() = [[Nasal library#geodtocart.28.29|geodtocart()]]
| parsexml
| parsexml() = [[Nasal library#parsexml.28.29|parsexml()]]
| resolvepath
| resolvepath() = [[Nasal library#resolvepath.28.29|resolvepath()]]
| rand
| rand() = [[Nasal library#rand.28.29|rand()]]
| srand
| srand() = [[Nasal library#srand.28.29|srand()]]
| md5
| md5() = [[Nasal library#md5.28.29_.283.1.2B.29|md5()]]
| abort
| abort() = [[Nasal library#abort.28.29|abort()]]
| #default = [[{{#if: {{{page|}}} <!-- is it on a different page?
-->| {{{page}}} <!-- yes
-->| {{FULLPAGENAME}} }}<!-- no, it's on the page that the template is used on
-->#{{{1}}}|{{{1}}}]]<!--
-->}}<!-- end #switch


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


--></code></span><!-- end extra formatting
  -->]] <!-- close wiki link
--></includeonly><noinclude>{{Informative template|1=
 
-->}}<!--
 
--></code></span> <!-- end formatting -->
 
| {{error|Missing argument!|func link}} <!-- missing argument case -->
}} <!-- close --></includeonly><noinclude>{{Informative template|1=
__NOTOC__
__NOTOC__
== Goal ==
== Goal ==
Line 130: Line 35:


== Usage ==
== Usage ==
  <nowiki>{{</nowiki>'''Func link'''<nowiki>|</nowiki>api<nowiki>|</nowiki>''page''<nowiki>|</nowiki>''ext''<nowiki>}}</nowiki>
  {{obr}}'''func link'''{{!}}api{{!}}''namespace''{{!}}''class''{{!}}''page=''{{!}}''link=''{{!}}''pre=''{{cbr}}


All parameters except '''api''' are optional
All parameters except '''api''' are optional


; api : Name of the function to link to.
; api : Name of the function to link to. Must include the brackets (<code>()</code>).


; page : Link to another wiki page, for example '''Help:Template'''.
; namespace : Optional namespace. Used when linking to the [[:Template:Nasal namespaces|namespace documentation]].


; ext : External link to another site.  Overrides '''page'''.
; class : Optional class. Used in link label.


== Examples ==
; page : Link to another wiki page, for example '''Help:Template'''. If given as "this", the template will use the page the template is on.
<nowiki>{{Func link|maketimer}} is available in FG 2.11+</nowiki>


{{Func link|maketimer}} is available in FG 2.11+
; link: External link to another site. Overrides '''page'''.


<nowiki>See also {{Func link|http.load()|page=List_of_Nasal_extension_functions}}.</nowiki>
; 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=_}}.


See also {{Func link|http.load()|page=List_of_Nasal_extension_functions}}.
== Examples ==
=== Link to namespace ===
<nowiki>See also {{func link|open()|io}}.</nowiki>
See also {{func link|open()|io}}.


  <nowiki>{{Func link|printf()|ext=http://en.wikipedia.org/wiki/Printf_format_string}}</nowiki>
=== Link to namespace and class ===
  <nowiki>{{func link|set_latlon()|geo|Coord}} is used to set coordinates.</nowiki>
{{func link|set_latlon()|geo|Coord}} is used to set coordinates.


{{Func link|printf()|ext=http://en.wikipedia.org/wiki/Printf_format_string}}
=== Link to external site ===
<nowiki>{{func link|printf()|link=http://en.wikipedia.org/wiki/Printf_format_string}}</nowiki>
{{func link|printf()|link=http://en.wikipedia.org/wiki/Printf_format_string}}


}}
}}


[[Category:Link templates]]
[[Category:Link templates]]
[[Category:Code templates]]
</noinclude>
</noinclude>

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()