codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
42 stars 24 forks source link

Fixed token replacement #151

Closed Toflar closed 4 years ago

Toflar commented 4 years ago

This fixes https://github.com/codefog/contao-haste/issues/150.

Recursive replacement of insert tags is not needed anymore as Contao does it itself. Same goes for this funny replacement of < and >. This used to be done back when we used eval() in the core to evaluate expressions.

Now that this is all gone, we can drop it but we need to raise the minimum supported version to 4.4 which should be no problem as this is the lowest supported version.

I did a PR for develop because I think we should release a new minor. Wdyt @aschempp @qzminski ?

aschempp commented 4 years ago

I think thats not correct. We run everything multiple times because an insert tag could return a simple token and vice versa. If a simple token returns an insert tag, we need to parse insert tags again.

Toflar commented 4 years ago

Yeah but that case is already correctly handled? Tokens are replaced first so if they return an insert tag we'll know. Then we parse insert tags which does parse recursively meaning it can never return any insert tags. That means we only need to check for simple tokens which we then do and start all over again if that's the case.