ultraq / thymeleafjs

A basic implementation of the Thymeleaf templating engine in JavaScript
Apache License 2.0
52 stars 8 forks source link

Supported expression syntax #20

Open ultraq opened 6 years ago

ultraq commented 6 years ago

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

Complex expressions

Literals

Text operations

Arithmetic operations

Boolean operations

Comparisons and equality

Conditional operators

Special tokens

rob-bar commented 5 years ago

The message expression is one that would be really handy. I will have a look on how we can implement it

rob-bar commented 5 years ago

How would we do a .substring now?

ultraq commented 5 years ago

I think you can do a .substring on any string now as both Java and JavaScript both call that method "substring". I haven't tried it with that method in particular, but being able to do method calls on objects is already possible.

rob-bar commented 5 years ago

alright!

oaj commented 1 year ago

Hi, I have a problem

    let templateEngine = new TemplateEngine({
        ...STANDARD_CONFIGURATION,
        messageResolver: async (key, parameters) => resolveMessage(key, lang, 'defaultMessage')
    })

const context = { user: user } templateEngine.processFile(fileName, context)

, it work on tags loike this with #

, but not on variable expressions

Dear

, this results in - Dear{0} The templates I have worked fine with spring thymeleaf Did I forget something ?