Difference between revisions of "Template:Flink"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>Bale
(fix spacing issue)
 
(46 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>
+
<includeonly><p><b>{{
{{#vardefine:par|no}}{{#vardefine:par|{{#if: {{{3|}}}|yes|no}}}}{{#vardefine:par|{{#if: {{{op1|}}}|yes|{{#var:par}}}}}}{{{1}}}&nbsp;{{{2}}}{{#ifeq: {{#var:par}}|yes|&nbsp;{{#if: {{{3|}}}|{{{3}}}&nbsp;}}{{#if: {{{4|}}}|{{{4}}}&nbsp;}}{{#if: {{{5|}}}|{{{5}}}&nbsp;}}{{#if: {{{6|}}}|{{{6}}}&nbsp;}}{{#if: {{{7|}}}|{{{7}}}&nbsp;}}{{#if: {{{op1|}}}|[{{{op1}}}]&nbsp;}}{{#if: {{{op2|}}}|[{{{op2}}}]&nbsp;}}{{#if: {{{op3|}}}|[{{{op3}}}]&nbsp;}}{{#if: {{{op4|}}}|[{{{op4}}}]&nbsp;}}{{#if: {{{op5|}}}|[{{{op5}}}]&nbsp;}}|()}}</b></p>{{#if: {{{desc|}}}|<div style="margin-left: 2em;">{{{desc}}}</div>}}
+
#vardefine:par|no}}{{
</includeonly>
+
#vardefine:par|{{
 +
#if: {{{3|}}}|yes|no}}}}{{{1}}}{{
 +
#ifeq: {{#var:par}}|yes|&nbsp;{{lnkstart}}{{{2}}}{{!}}{{{2}}}&#40;{{
 +
#if: {{{3|}}}|&nbsp;{{{3}}}}}{{
 +
#if: {{{4|}}}|,&nbsp;{{{4}}}}}{{
 +
#if: {{{5|}}}|,&nbsp;{{{5}}}}}{{
 +
#if: {{{6|}}}|,&nbsp;{{{6}}}}}{{
 +
#if: {{{7|}}}|,&nbsp;{{{7}}}}}{{
 +
#if: {{{8|}}}|,&nbsp;{{{8}}}}}{{
 +
#if: {{{9|}}}|,&nbsp;{{{9}}}}}&nbsp;&#41;{{lnkend}}}}{{
 +
#ifeq: {{#var:par}}|no|&nbsp;[[{{{2}}}|{{{2}}}()]]}}</b></p>{{
 +
#if: {{{desc|}}}|<div style="margin-left: 2em; display: block;">{{{desc}}}</div>}}</includeonly>
 
<noinclude>
 
<noinclude>
 
<p>This template styles a function call so that it can be displayed as a link in (pseudo) Category pages.</p>
 
<p>This template styles a function call so that it can be displayed as a link in (pseudo) Category pages.</p>
<p>This template requires ''at least'' two (unnamed) parameters to be passed; the first is the dataype returned by the function; the second is the name of the function (''without'' parenthesis).</p>
+
<p>This template requires ''at least'' two (unnamed) parameters to be passed; the first is the datatype returned by the function; the second is the name of the function (''without'' parenthesis).</p>
<p>All additional unnamed parameters will be parsed as datatypes, in order, of the required parameters. (Up to 5 can be supplied.)</p>
+
<p>All additional unnamed parameters will be parsed as datatypes, in order, of the usable parameters. (Up to 8 can be supplied.)</p>
 
<p>An optional named parameter ''desc'' can be used to include a brief description of the what the function does, which will automatically be included in its display.</p>
 
<p>An optional named parameter ''desc'' can be used to include a brief description of the what the function does, which will automatically be included in its display.</p>
<p>Optional parameters can be displayed by passing up to 5 named parameter, "op1" through "op2".</p>
+
<p>Optional parameters can be displayed by wrapping them in the [[Template:Opt|Opt Template]].</p>
 +
<p>&nbsp;</p>
 
<pre>
 
<pre>
 
{{Flink|int|some_function}}
 
{{Flink|int|some_function}}
Line 14: Line 26:
 
{{Flink|int|some_function}}
 
{{Flink|int|some_function}}
 
<pre>
 
<pre>
{{Flink|string|other_function|op1=float|desc=This is what this bad boy does; blah de freakin' blah}}
+
{{Flink|string|other_function|{{opt|float}}|desc=This is what this bad boy does; blah de freakin' blah}}
 
</pre>
 
</pre>
 
<p>Returns:</p>
 
<p>Returns:</p>
{{Flink|string|other_function|op1=float|desc=This is what this bad boy does; blah de freakin' blah}}
+
{{Flink|string|other_function|{{opt|float}}|desc=This is what this bad boy does; blah de freakin' blah}}
 
[[Category:Basic Templates]]
 
[[Category:Basic Templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 23:33, 22 March 2017


This template styles a function call so that it can be displayed as a link in (pseudo) Category pages.

This template requires at least two (unnamed) parameters to be passed; the first is the datatype returned by the function; the second is the name of the function (without parenthesis).

All additional unnamed parameters will be parsed as datatypes, in order, of the usable parameters. (Up to 8 can be supplied.)

An optional named parameter desc can be used to include a brief description of the what the function does, which will automatically be included in its display.

Optional parameters can be displayed by wrapping them in the Opt Template.

 

{{Flink|int|some_function}}

Returns:

int some_function()

{{Flink|string|other_function|{{opt|float}}|desc=This is what this bad boy does; blah de freakin' blah}}

Returns:

string other_function( [float] )

This is what this bad boy does; blah de freakin' blah