pyrocms / lex

A lightweight template parser used by PyroCMS.
110 stars 31 forks source link

Double tags are greedy #4

Closed jerel closed 11 years ago

jerel commented 12 years ago

This was opened as an issue on PyroCMS with this test code:

{{ plugin:some_method attribute="value" }}

{{ plugin:some_method attribute="value" }}
    Some Content
{{ /plugin:some_method }}

Lex matches the outermost tags instead of the innermost so the {{ plugin:some_method attribute="value" }} on line 3 is considered a single tag. Would it be better if Lex was lazy instead?

adamfairholm commented 12 years ago

I've seen this come up a few times in support requests for Pyro. The workaround I have them try is to just close everything even if there is nothing between the tags. This would be a nice feature to have, though.

dhrrgn commented 12 years ago

Hmm...I thought I fixed this sort of issue a long time ago. Evidentially not. Looking at it right now.

dhrrgn commented 12 years ago

Re-opening, just realized this doesn't work 100%

philsturgeon commented 12 years ago

Did you get any further on this one dude?

dhrrgn commented 12 years ago

Not yet. I need to think on it a bit. It is not a simple thing to do.

philsturgeon commented 11 years ago

Poke!

dhrrgn commented 11 years ago

After a lot of consideration, I have determined that this is not a bug. I have made it easier, and added some explanation here: http://dandoescode.com/blog/2013/01/11/lex-2-dot-3/