This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

Macro Definition Syntax

 21st February 2015 at 10:23pm

Deprecated since:5.3.0(seeProcedure Definition Syntax)


What follows is a formal presentation of the syntax of the \define pragma, using railroad diagrams. A simpler overview is also available.

\definespacenameparamsspacerest

space denotes a sequence of whitespace characters.

The macro's name is a sequence of non-whitespace characters other than ( or >.

The parameter declaration list (params) has the following syntax:

(sepparamsep)

The parameter separator (sep) is any sequence of characters that does not match a param-name. Among other things, this includes commas, spaces and linefeeds.

A param-name is a sequence of letters (AZ, az), digits (09), hyphens (-) and underscores (_).

Each individual param has the following syntax:

param-namespace:spacedefault)

The optional default value of a parameter is specified as follows:

"""anything but """""""anything but ""'anything but ''[[anything but ]]]anything but ' " or whitespace

The rest of the definition has the following syntax:

snippetlfsnippetlf\endspacelf

lf denotes a linefeed.

The snippet is any sequence of characters that doesn't terminate the macro definition. That is to say, a single-line snippet cannot contain a linefeed, and a multi-line snippet cannot contain \end on a line of its own.

The snippet can contain placeholders with the following syntax:

$name$$(name)$