Appendix A. TPT Reference

Table of Contents

Preprocessor control
@# comment
@tpt_ignoreindent, @tpt_noignoreindent
@tpt_ignoreblankline, @tpt_noignoreblankline
@<, @>
@include
@includetext
Setting Variables
@set
@setif
@unset
@push
@pop
Conditional Parsing
@if/@elsif/@else
Loops
@while
@foreach
String Functions
@compare, @comp, @strcmp
@concat
@substr
@length
@empty
@lc
@uc
@lpad
@rpad
@repeat
Math Functions
@avg
@sum
Array Functions
@isarray
@size
Hash Functions
@ishash
@keys
General Functions
@eval
@rand

Preprocessor control

The following functions affect the flow of the Lexical Analyzer, and are never parsed.

@# comment

Ignore everything until the end of the line. If the comment is the first item on the line, the entire line will be ignored.

@# This is a whole line comment, so this line will be ignored
	@# This is not

@mymacro(a, b, c)	@# describe my macro

@tpt_ignoreindent, @tpt_noignoreindent

When @tpt_ignoreindent is called (with no parenthesis), all indentation on the following lines will be ignored. Use @tpt_noignoreindent to stop ignoring indentation.

@itpt_ignoreindent\
	@if (x) {
		Four score and seven years ago...
	} @else {
		We the people of the United States...
	}

Note: @ignoreindent and @noignoreindent are depricated.

@tpt_ignoreblankline, @tpt_noignoreblankline

When @tpt_ignoreblankline is called (with no parenthesis), any line with no content (including white-space) will be ignored.

@tpt_ignoreblankline\
@macro1() {...}

@macro2() {...}

@macro3() {...}

@tpt_noignoreblankline

Note: @ignoreblankline and @noignoreblankline are depricated.

@<, @>

The ignore space operators instruct the lexical analyzer to ignore any space preceding @<, or any space following @>.

@# ignore spaces after @>
@>	This should be flush to the left
@# ignore spaces before @<
	@<This should be flush to the left

@include

Include and parse a TPT header file, usually a filename ending in .tph.

@include("macros.tph")\
@include('heading.tph')\
			

@includetext

(1.20+)

Include a raw text file without parsing. This is useful when including some kind of raw statement, like a license agreement.

@includetext("license.txt")\