feulf/raintpl

`path_replace` broken by RainTPL tag inside url

Closed this issue · 0 comments

Example: <a href="/foo/{function="bar()"}"> should be path-replaced by <a href="base_url/foo/{function="bar()"}"> but is not.

This is due to the fact that template file is splited around {function="foo()"}, as around each RainTPL tag (e.g. loop, if, etc) before path_replace is called.

My question is: Is it possible to swap splitting and url rewriting without broken anything? Why is this ordered like that? I believe there is one good reason, but if there is, fixing that issue might be more complicated.

Note: Another anoying point is the presence of double colons around function name since the first one is seen by path_replace as the closing colon of url. It can be easyly fixed by changing the url regex from .*? to (?:(?:\\{.*?\\})?[^{}]*?)*?. I started a PR but can't finish it without knowing whether I can reorder splitting and url rewriting.