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

Procedure Definition Syntax

 10th March 2024 at 5:50pm

What follows is a formal presentation of the syntax of the Pragma: \procedure, using railroad diagrams.

\procedure

There are 2 types of procedure definitions

  • Single line definitions
  • Multi line definitions

Single Line

Single line definitions should only be used for very short bodies, where the procedure name, params and the body fit into 1 line terminated with a line-feed.

\procedurespaceprocedure-name(params)spacebodylf

Multi Line

The majority of procedure definitions will have a body, that spans over several lines of wikitext. Those procedure definitions are terminated using the "\end" pragma

\procedurespaceprocedure-name(params)spacebody\end

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

  • procedure-name is a sequence of letters (AZ, az), digits (09), hyphens (-) and underscores (_)
  • body is wikitext including nested procedures
  • space denotes a sequence of whitespace characters

params

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

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

Each individual parameter has the following syntax:

param-namespace:spacedefault
  • param-name is a sequence of letters (AZ, az), digits (09), hyphens (-) and underscores (_).
  • default is an optional value of a parameter is specified as follows:
"""anything but """""""anything but ""'anything but ''[[anything but ]]]anything but ' " or whitespace

body

The body of the definition has the following syntax:

wikitextlf
  • wikitext is any sequence of characters that doesn't terminate the macro definition.
    • If nested procedures are used they need to be at the start of the wikitext. There are the same rules as if the wikitext would be in a tiddler.
    • Pragmas need to be before standard wikitext.
  • lf denotes a linefeed.