Skip to content

Template Language

sheogorath15 edited this page Aug 14, 2023 · 4 revisions

Template Language

Anything between {{ }} will be interpreted as an expression and the result of that expression will be evaluated to the user

  • {{ VAR }} -> will output the value of the variable VAR
  • {{ VAR + 5 }} -> will output the value of VAR plus the number 5
  • {{ VAR == 5 }} -> will output True if VAR is equal to 5 otherwise False
Bildschirm­foto 2023-02-24 um 14 33 53 Bildschirm­foto 2023-02-24 um 14 34 22

The syntax language supports the creation and evaluation of arbitrarily complex expressions, but does not support assignment.

It is important to leave a space between the braces and the input

It is important to refer to variables with the same capitalisation they were defined with.

The template syntax also supports returning information from tables.

  • {{ TABLE_NAME.RETURN_COLUMN(LOOKUP_COLUMN=VAR) }} -> returns the value of an entry from the column RETURN_COLUMN from the table TABLE_NAME at the row where the column LOOKUP_COLUMN has the value stored in VAR.
    • For example, if you have a table called "hotel_costs", with a column "country" and a column "cost" the following expression: {{ hotel_costs.cost(country="Spain") }} would return the cost associated with the given country "Spain".
  • {{ TABLE_NAME.COLUMN_NAME(VAR1=VAL1, VAR2=VAL2) }} -> returns the value of COLUMN_NAME from the table TABLE_NAME at the row where the column VAR1 has has the value stored in VAL1 and the column VAR2 has the value stored in VAL2
    • {{ DAILY_COSTS.PER_DIAM(COUNTRY=USER_COUNTRY, CITY=USER_CITY) }} -> Returns the Per diam from the table daily costs, for the country and city specified by the user (via the variables USER_COUNTRY and USER_CITY)
Clone this wiki locally