.if Macro

This macro is used for conditional generation, it has the following syntax:

.if[not] condition
		complex-template
	[(.elsif[not] condition
		complex-template)*]
	[.else
		complex-template]
.endif [(tail)]

The following parameters are available:

Parameter

Description

condition

The condition to evaluate, in the form:

variable [operator comparison]

Where operator may be any of ==, =, <=, >=, <, or >. If both operands are integers, the <, >, >=, and <= operators perform integer comparisons; otherwise they perform a string comparison that takes into account embedded numbers (example: Class_10 is greater than Class_2).

Where comparison may be any of:

  • A simple template

  • "text"

  • true

  • false

  • null

  • notnull

If no operator and condition are specified, the condition evaluates to true unless the value of the variable is false, null or the null string.

You can chain conditions together using the and or or logical operators.

Type: Simple template

complex-template

The template to apply is the condition is true.

Type: Complex template

tail

Appended to the output, if there is one

Type: Text