English فارسی Suomi
Français Nederlands Translate

Campsite 3.4

Campsite: LanguageElements

Language Elements; Conventions

In the following sub chapters describing the template language we used the following conventions:

  • identifiers in between '<' and '>' must be replaced in the template according to their description
  • spaces must be used as in the language description
  • identifiers that are not in between '<' and '>' are language keywords and must be written as in the language description
  • identifiers enclosed by '[' and ']' characters are not mandatory in the statement
  • sequences of identifiers separated by '|' character describe a situation where all the identifiers are valid but only one can be used at a time

The template language is composed out of:

  • statements: they are keywords with a special meaning that define actions taken by template parser
  • parameters: are keywords describing statement features; they are used to specify statement constraints
  • parameter values: keywords that describe the parameter must take

Any value must be put in between double quotes (""). The double quote (") must be escaped any time it is used in an identifier. E.g.: escaping a value that contains quote:

{{ if $campsite->article->name == "Lucas \"the beast\"" }}

In some statements (usually lists) there is a special parameter named "constraints". This parameter describes conditions that can not be specified in the usual way:

parameter="value"

The constraints are specified in the following way:

constraints="<constraints_list>"

Constraints are built from the following expressions:

  • comparison expressions: <attribute> <operator> <value>
  • attributes without type: <attribute>

Attributes may have no type or one of the following types:

  • integer: signed, 10 digits number
  • string of characters: may contain any character except control characters - these will be removed automatically
  • switch: has two values: "on" and "off"
  • date: year, month, day; where date value is specified it must be written in "yyyy-mm-dd" format
  • time: hour, minute, second; where time value is specified it must be written in "hh:mm:ss" format
  • datetime: year, month, day, hour, minute, second; where datetime value is specified it must be written in "yyyy-mm-dd hh:mm:ss" format
  • topic: list of names defined by the application user used for categorizing articles

Every type has a list of valid operators that can be used on attributes of that certain type. The operators list corresponding to defined types:

  • integer: <integer_operator> = is | not | greater | greater_equal | smaller | smaller_equal
  • string of characters: <string_operator> = is | not | greater | greater_equal | smaller | smaller_equal
  • switch: <switch_operator> = is | not
  • date: <date_operator> = is | not | greater | greater_equal | smaller | smaller_equal
  • time: <time_operator> = is | not | greater | greater_equal | smaller | smaller_equal
  • datetime: <datetime_operator> = is | not | greater | greater_equal | smaller | smaller_equal
  • topic: <topic_operator> = is | not

Spaces in values must be escaped with backslash.

E.g.: constraints="topic is Global\ Warming:en"
In this case "Global Warming" is the topic name.


EDIT