From 690c8fe9a0f8360d601b49e391113a12ee4d1783 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 9 Apr 2014 14:33:47 +0100 Subject: [PATCH] Update macros docs Include single line macros --- .../tw5.com/tiddlers/wikitext/Macros in WikiText.tid | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/editions/tw5.com/tiddlers/wikitext/Macros in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Macros in WikiText.tid index 004054f4b..69952fd2d 100644 --- a/editions/tw5.com/tiddlers/wikitext/Macros in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Macros in WikiText.tid @@ -1,12 +1,14 @@ created: 20131205160746466 -modified: 20140211190841939 +modified: 20140409133148420 tags: wikitext title: Macros in WikiText type: text/vnd.tiddlywiki ! Defining Macros -Macros are snippets of text that can be inserted with a concise shortcut. A macro is defined like this: +Macros are snippets of text that can be inserted with a concise shortcut. + +Multi-line macros are defined like this: ``` \define mysamplemacro(name:"Bugs Bunny",address:"Rabbit Hole Hill") @@ -16,6 +18,12 @@ Hi, I'm $name$ and I live in $address$ The first line of the definition specifies the macro name and any parameters. Parameters are named and can optionally have default values that are used if the parameter isn't specified at the time of calling. The body of the macro definition follows, terminated with `\end`. The macro can include parameters using the `$name$` construction. +Single-line macros can omit the `\end` marker like this: + +``` +\define mysamplemacro(name:"Bugs Bunny") Hi, I'm $name$ +``` + Macro definitions must be placed at the top of a tiddler. Macros are available to the tiddler that defines them, plus any tiddlers that it transcludes. [[JavaScript Macros]] can also be used for more flexibility.