Template:Func link: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Update from sandbox)
Line 1: Line 1:
<includeonly><!--
<includeonly>{{#if: {{{1|}}} <!-- has argument -->
| <span class="plainlinks"><code><!-- formatting
-->{{#if: {{{link|}}} <!-- has link? -->
  | [{{{link}}} {{{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|{{error|Missing argument!|func link}}}}}]<!-- 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 = {{error|Missing argument!|func link}} <!-- 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 -->
| abort
| abort() = [[Nasal library#abort.28.29|abort()]]
| abs
| abs() = [[Nasal library#abs.28.29|abs()]]
| addcommand
| addcommand() = [[Nasal library#addcommand.28.29|addcommand()]]
| airportinfo
| airportinfo() = [[Nasal library#airportinfo.28.29|airportinfo()]]
| airwaysRoute
| airwaysRoute() = [[Nasal library#airwaysRoute.28.29|airwaysRoute()]]
| assert
| assert() = [[Nasal library#assert.28.29|assert()]]
| carttogeod
| carttogeod() = [[Nasal library#carttogeod.28.29|carttogeod()]]
| _cmdarg
| cmdarg
| _cmdarg()
| cmdarg() = [[Nasal library#cmdarg.28.29|cmdarg()]]
| courseAndDistance
| courseAndDistance() = [[Nasal library#courseAndDistance.28.29|courseAndDistance()]]
<!--
| _createCondition
| _createCondition() = [[Nasal library#_createCondition.28.29|_createCondition()]]not sure whether to doc this one yet
-->
| createWP
| createWP() = [[Nasal library#createWP.28.29|createWP()]]
| createWPFrom
| createWPFrom() = [[Nasal library#createWPFrom.28.29|createWPFrom()]]
| defined
| defined() = [[Nasal library#defined.28.29|defined()]]
| directory
| directory() = [[Nasal library#directory.28.29|directory()]]
| fgcommand
| _fgcommand
| fgcommand
| _fgcommand() = [[Nasal library#fgcommand.28.29|fgcommand()]]
| findAirportsByICAO
| findAirportsByICAO() = [[Nasal library#findAirportsByICAO.28.29|findAirportsByICAO()]]
| findAirportsWithinRange
| findAirportsWithinRange() = [[Nasal library#findAirportsWithinRange.28.29|findAirportsWithinRange()]]
| findFixesByID
| findFixesByID() = [[Nasal library#findFixesByID.28.29|findFixesByID()]]
| findNavaidByFrequency
| findNavaidByFrequency() = [[Nasal library#findNavaidByFrequency.28.29|findNavaidByFrequency()]]
| findNavaidsByFrequency
| findNavaidsByFrequency() = [[Nasal library#findNavaidsByFrequency.28.29|findNavaidsByFrequency()]]
| findNavaidsByID
| findNavaidsByID() = [[Nasal library#findNavaidsByID.28.29|findNavaidsByID()]]
| findNavaidsWithinRange
| findNavaidsWithinRange() = [[Nasal library#findNavaidsWithinRange.28.29|findNavaidsWithinRange()]]
| finddata
| finddata() = [[Nasal library#finddata.28.29|finddata()]]
| flightplan
| flightplan() = [[Nasal library#flightplan.28.29|flightplan()]]
| geodinfo
| geodinfo() = [[Nasal library#geodinfo.28.29|geodinfo()]]
| geodtocart
| geodtocart() = [[Nasal library#geodtocart.28.29|geodtocart()]]
| getprop
| getprop() = [[Nasal library#getprop.28.29|getprop()]]
| greatCircleMove
| greatCircleMove() = [[Nasal library#greatCircleMove.28.29|greatCircleMove()]]
| _interpolate
| interpolate
| _interpolate()
| interpolate() = [[Nasal library#interpolate.28.29|interpolate()]]
| isa
| isa() = [[Nasal library#isa.28.29|isa()]]
| logprint
| logprint() = [[Nasal library#logprint.28.29|logprint()]]
| magvar
| magvar() = [[Nasal library#magvar.28.29|magvar()]]
| maketimer
| maketimer() = [[Nasal library#maketimer.28.29|maketimer()]]
| md5
| md5() = [[Nasal library#md5.28.29|md5()]]
| navinfo
| navinfo() = [[Nasal library#navinfo.28.29|navinfo()]]
| parse_markdown
| parse_markdown() = [[Nasal library#parse_markdown.28.29|parse_markdown()]]
| parsexml
| parsexml() = [[Nasal library#parsexml.28.29|parsexml()]]
| print
| print() = [[Nasal library#print.28.29|print()]]
| printf
| printf() = [[Nasal library#printf.28.29|printf()]]
| printlog
| printlog() = [[Nasal library#printlog.28.29|printlog()]]
| rand
| rand() = [[Nasal library#rand.28.29|rand()]]
| registerFlightPlanDelegate
| registerFlightPlanDelegate() = [[Nasal library#registerFlightPlanDelegate.28.29|registerFlightPlanDelegate()]]
| removecommand
| removecommand() = [[Nasal library#removecommand.28.29|removecommand()]]
| removelistener
| removelistener() = [[Nasal library#removelistener.28.29|removelistener()]]
| resolvepath
| resolvepath() = [[Nasal library#resolvepath.28.29|resolvepath()]]
| _setlistener
| setlistener
| _setlistener()
| setlistener() = [[Nasal library#setlistener.28.29|setlistener()]]
| setprop
| setprop() = [[Nasal library#setprop.28.29|setprop()]]
| settimer
| settimer() = [[Nasal library#settimer.28.29|settimer()]]
| srand
| srand() = [[Nasal library#srand.28.29|srand()]]
| systime
| systime() = [[Nasal library#systime.28.29|systime()]]
| thisfunc
| thisfunc() = [[Nasal library#thisfunc.28.29|thisfunc()]]
| tileIndex
| tileIndex() = [[Nasal library#tileIndex.28.29|tileIndex()]]
| tilePath
| tilePath() = [[Nasal library#tilePath.28.29|tilePath()]]
| values
| values() = [[Nasal library#values.28.29|values()]]
| #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
  -->{{{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 202: Line 35:


== Usage ==
== Usage ==
  {{obr}}'''Func link'''{{!}}api{{!}}''page=''{{!}}''ext=''{{cbr}}
  {{obr}}'''func link'''{{!}}api{{!}}''namespace''{{!}}''class''{{!}}''page=''{{!}}''link=''{{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.
=== Pre-made links ===
This example uses the pre-made links for certain APIs.


{{inote|<code><nowiki>{{Func link|maketimer()}}</nowiki></code> is equivalent.}}
; link: External link to another site. Overrides '''page'''.


  <nowiki>{{Func link|maketimer}} is available in FG 2.11+</nowiki>
== Examples ==
{{Func link|maketimer}} is available in FG 2.11+
=== Link to namespace ===
  <nowiki>See also {{func link|open()|io}}.</nowiki>
See also {{func link|open()|io}}.


=== Link to another wiki page ===
=== Link to namespace and class ===
  <nowiki>See also {{Func link|http.load()|page=Nasal library}}.</nowiki>
  <nowiki>{{func link|set_latlon()|geo|Coord}} is used to set coordinates.</nowiki>
See also {{Func link|http.load()|page=Nasal library}}.
{{func link|set_latlon()|geo|Coord}} is used to set coordinates.


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


}}
}}

Revision as of 13:42, 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=}}

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.

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