-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another nested object problem #59
Comments
Okay, I've tinkered with this off and on, and tracked down the source of the problem. At the beginning of the When there is additional template text after where the current block should end (a common use-case -- think about footers after a data block), and the tagnames between the current block and the appended block match, this will grab too much text. For example. consider this template: <div id='article'>
<div class='byline'></div>
<div class='content'></div>
</div>
<div id='footer'></div> I've created a new gist (simpler than my previous one) to illustrate: https://gist.github.com/2595351 If plates was handling things as a DOM (even just a simplified one), it would be easier to handle. You could just count elements on the stack. But since it's doing pseudo-stream state-machine parsing, it's tricker to look ahead. I'm mulling it over to see if I can come up with a patch that's not too ugly. |
I've got a patch that seems to be working, though I haven't done extensive testing yet. One known flaw so far, is with dealing with html comments (or presumably other content) at the end of a sub-block being processed. |
Okay, my latest fix seems to work pretty well. The only niggle I have is that it doesn't perfectly preserve whitespace after processing a sub-object block for some reason. But none of the other test cases worry about whitespace, so I guess I won't either. |
When dealing with a nested object, plates seems to lose track of something if the template uses higher-level data after dealing with the sub-object. I've created a test case, and a gist to illustrate: https://gist.github.com/2370943
As you'll see, plates seems to be outputting the unprocessed template snippet, then the copy with substitutions made.
The text was updated successfully, but these errors were encountered: