Skip to content

Supported expression syntax #20

Open
@ultraq

Description

@ultraq

A list of the expression syntaxes currently supported in the latest version of ThymeleafJS. The full list of expression syntaxes was taken from the Thymeleaf docs here: https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#standard-expression-syntax

Simple expressions

  • Variable Expressions: ${...}
  • Selection Variable Expressions: *{...}
  • Message Expressions: #{...}
  • Link URL Expressions: @{...}
  • Fragment Expressions: ~{...}

Complex expressions

  • Iteration expressions

Literals

  • Text literals: 'one text', 'Another one!',...
  • Number literals: 0, 34, 3.0, 12.3,...
  • Boolean literals: true, false
  • Null literal: null
  • Literal tokens: one, sometext, main,...

Text operations

  • String concatenation: +
  • Literal substitutions: |The name is ${name}|

Arithmetic operations

  • Binary operators: +, -, *, /, %
  • Minus sign (unary operator): -

Boolean operations

  • Binary operators:
    • &&
    • and
    • ||
    • or
  • Boolean negation (unary operator):
    • !
    • not

Comparisons and equality

  • Comparators:
    • >
    • <
    • >=
    • <=
    • gt
    • lt
    • ge
    • le
  • Equality operators:
    • ==, ===
    • !=, !==
    • eq
    • ne

Conditional operators

  • If-then: (if) ? (then)
  • If-then-else: (if) ? (then) : (else)
  • Default: (value) ?: (defaultvalue)

Special tokens

  • No-Operation: _

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions