ultraq / thymeleafjs

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

Support URL expression syntax #9

Closed yubaoquan closed 6 years ago

yubaoquan commented 6 years ago

Currently url expression cannot be correctly rendered, need working on it.

ultraq commented 6 years ago

Some more details in here: https://github.com/ultraq/thymeleaf-js/issues/8#issuecomment-332541321

Thanks for raising this issue @yubaoquan 👍

ultraq commented 6 years ago

I've added some basic support for URL expressions and made a release with them. I based them off the examples in the Thymeleaf docs (http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#link-urls) but I couldn't see any for the examples you had in the linked issue. Examples like: @{http://www.baidu.com?query(p=${a})} where the URL part already has a ? in it. What's the expected behaviour of that?

The sorts of things I've added are support for creating a search string from the parameters part of the URL, eg: where a = "hello":

@{http://www.baidu.com/(p=${a})} -> http://www.baidu.com/?p=hello

And placeholders in the URL, eg: where a = "hello";

@{http://www.baidu.com/{path}/(path=${a})} -> http://www.baidu.com/hello/

yubaoquan commented 6 years ago

OK thanks for the work. Maybe the example i wrote before contains some typos. I'll check the doc later.

ultraq commented 6 years ago

Closing, this has been added.