mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 11:37:20 +00:00
9b78e871aa
* Update ParametersWidget and add Examples This PR updates the ParametersWidget.tid and adds several examples * Update Procedure and Parameters Pragma This PR improve documentation for using parameters inside procedures * Update Pragma_ _procedure.tid A caution when use parameters inside procedures * Resolved conversation All comments by Jeremy were implemented.
27 lines
1.3 KiB
Plaintext
27 lines
1.3 KiB
Plaintext
created: 20220917113154900
|
|
modified: 20230518143557045
|
|
tags: Pragmas
|
|
title: Pragma: \parameters
|
|
type: text/vnd.tiddlywiki
|
|
|
|
<<.from-version "5.3.0">> The ''\parameters'' [[pragma|Pragmas]] is used within [[procedure|Procedure Definitions]] and [[widget|Custom Widgets]] definitions to declare the parameters that are expected, and their default values. It is a shortcut syntax for the ParametersWidget.
|
|
|
|
```
|
|
\parameters (<name>[:<default-value>],<name>[:<default-value>]...)
|
|
```
|
|
|
|
For example:
|
|
|
|
```
|
|
\parameters (firstname:"Joe",lastname:"Blogs")
|
|
```
|
|
|
|
To illustrate the use of ''\parameters'' pragma, see [[Core Icons]] which are parameterised. The first parameter `size` specified the size at which the icon should be rendered. For example see the text of [[$:/core/images/print-button]] tiddler. The first line defines the size parameter as `\parameters (size:"22pt")`
|
|
|
|
<<wikitext-example-without-html """{{$:/core/images/print-button|16px}}
|
|
<$transclude $tiddler="$:/core/images/print-button" size="32px"/>
|
|
""">>
|
|
|
|
In the above example, the first line shows a simple transclusion of [[$:/core/images/print-button]] icon with `size` parameter passed by position and is set to 16px. The second line is a transclusion of image with `size` parameter passed by name and is set to 32px.
|
|
|