Function Calling Convention
Functions are macros which are embedded in the wiki text that when called can alter the text of the wikipage, add meta-data, modify formatting, search, etc. Whitespace before and after the delimiters does not affect the values being passed.
Parameters are the values that are passed to functions which dictate their behavior. When multiple parameters are being passed to a function, they must be delimited by a comma (,) symbol.
Parameters come in three varieties:
- Required
- When a function has required parameters, they must be passed, or an error will occur. If a function has required parameters, they will always the first parameters.
- Required parameters cannot come after optional parameters.
- Optional
- If a function has optional parameters, they do not need to be specified in the function call.
- If a function has both optional and required parameters, the optional parameters will always come after the required.
- Optional parameters have default values which are used when the parameter is not passed.
- Infinite
- Infinite parameters are rather special but are used quite frequently in this wiki.
- Infinite parameters allow you to pass many values to a function. For example, if you were to call a function that takes "search terms" as a parameter, you'd likely want to add more than one term. Infinite parameters allow you to do just that.
- Infinite parameters can be either optional or required.
- All parameters that come after an infinite parameter will always be optional.
- All parameters that come after an infinite parameter must be passed by name.
In this example, you can see that we are calling the TextList() function and passing it several search terms. We are able to pass as many as we like because the first parameter of the TextList() function is an infinite parameter.
Example
##TextList(wiki, help, official)Again, in this example, you can see that we are calling the TextList() function and passing it several search terms - but we also want to now pass the top parameter to limit the number of pages the function will return. As discussed previously, if the optional parameter comes after an infinite parameter, then we must pass the optional parameter by name.
Passing an optional parameter by name is as simple as placing a colon before the name of the parameter, followed by an equal sign and then the value we want to pass. See below that the :top=5 parameter is being passed by name:
Example
##TextList(wiki, help, official , :top=5)Additionally if we want to pass the view parameter, we'd add a (,) symbol to denote a new parameter and then specify the colon, parameter name and value just as before: :view=List:
Example
##TextList(wiki, help, official , :top=5, :view=List)Some functions take parameters that expect specific values from a discrete set of values to be passed. If you pass an invalid parameter value, an error will occur.
Parameters are constrained to one of several data types:
- String
- String are text type parameters. Basically, everything goes. When you need to include special characters (such as a comma), you can enclose your string parameter in double quotes. If you also need to include a double quote in your text, you can escape with a backslash (\). For example "This \"is\" a test".
- Integer
- Non-decimal numeric values between -2,000,000,000 and +2,000,000,000
- Double
- Decimal numeric values between. Both precise and large.
Function Calling Convention
Scope Function
Instruction Function
Standard Function
Wiki Help :: Include Instruction
Processing instruction indicating the page is an include and not a while page.
Wiki Help :: Inject
Inserts the un-processed wiki body of one page into the calling page.
Wiki Help :: Jumbotron
Large grey box good for calling attention in a non-critical way.
Wiki Help :: LastModified
Displays the modified date/time of the page.
Wiki Help :: LastModifiedBy
Displays the name of the person last modified the current page.
Wiki Help :: Links
Linking between wiki pages and external content.
Wiki Help :: MostEdited
Display a list of the most edited pages.
Wiki Help :: MostViewed
Display a list of the most viewed pages.
Wiki Help :: Name
Displays the pages name.
Wiki Help :: Namespace
Displays the namespace of the wiki page.