diff --git a/editions/tw5.com/tiddlers/wikitext/Macro Definitions in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Macro Definitions in WikiText.tid index 4e376a6d4..693e7833c 100644 --- a/editions/tw5.com/tiddlers/wikitext/Macro Definitions in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Macro Definitions in WikiText.tid @@ -1,13 +1,13 @@ caption: Macro Definitions created: 20150220181617000 -modified: 20171215152754837 +modified: 20180820165115455 tags: WikiText title: Macro Definitions in WikiText type: text/vnd.tiddlywiki A [[macro|Macros]] is defined using a `\define` [[pragma|Pragma]]. Like any pragma, this can only appear at the start of a tiddler. -The first line of the definition specifies the macro name and any parameters. Each parameter has a name and, optionally, a default value that is used if no value is supplied on a particular call to the macro. The lines that follow contain the macro's text (i.e. the snippet represented by the macro name), until `\end` appears on a line by itself: +The first line of the definition specifies the macro name and any parameters. Each parameter has a name and, optionally, a default value that is used if no value is supplied on a particular call to the macro. The lines that follow contain the text of the macro text (i.e. the snippet represented by the macro name), until `\end` appears on a line by itself: <$codeblock code={{$:/editions/tw5.com/macro-examples/say-hi}}/> @@ -20,20 +20,21 @@ Alternatively, the entire definition can be presented on a single line without a A more formal [[presentation|Macro Definition Syntax]] of this syntax is also available. !! Accessing variables and parameters -Inside the macro there are a few methods for accessing variables and parameters defined outside of the macro or in the macro parameter list. + +Inside the macro there are several methods for accessing variables defined outside of the macro or parameters from the macro parameter list. |syntax|description|h -|`$...$`|parameter defined in the macro parameters list| -|`<<__...__>>`|parameter defined in the macro parameters list but the syntax evaluates the parameter as it is invoked| -|`$(...)$`|variable placeholder to variable defined outside of the macro| -|`<<...>>`|variable invocation of variable (or other macro) defined outside of the macro| +|`$...$`|Text substitution of a parameter defined in the macro parameters list | +|`<<__...__>>`|Parameter-as-variable access to a parameter defined in the macro parameters list | +|`$(...)$`|Text substitution of a variable defined outside of the macro | +|`<<...>>`|Access to a variable (or other macro) defined outside of the macro |
!!! Placeholders `$(...)$` The macro can contain placeholders for parameters. These consist of a parameter name between dollar signs, like `$this$`. -It can also contain placeholders for [[variables|Variables]]. These consist of a variable name (or macro name) between dollar signs and round brackets, like `$(this)$`. +The macro can also contain placeholders for [[variables|Variables]]. These consist of a variable name (or macro name) between dollar signs and round brackets, like `$(this)$`. The actual value of the parameter or variable is substituted for the placeholder whenever the macro is called: