kolber / stacey

Cheap & easy content management
http://staceyapp.com
MIT License
1.04k stars 131 forks source link

Incorrect treatment of @variables within asset collection #41

Open thor opened 12 years ago

thor commented 12 years ago

Let's say I have...

this:
foreach $images do
    <article title="photo: @title">
        <figure>
            <img src="@small" if @title do alt="@title" endif />
            if @variable do @variable endif
            if @title do @variable endif
            @variable
        </figure>
        if @description do <p>@description</p> endif
    </article>
endforeach

... where @variable is "success!" and @title is "expected success!".

... and then I get this:
foreach $images do
    <article title="photo: @title">
        <figure>
            <img src="@small" if @title do alt="@title" endif />
            <!--- missing @variable here -->
            success!
            success!
        </figure>
        if @description do <p>@description</p> endif
    </article>
endforeach

The expected behavior would in my opinion be that the @variable can be checked and returned to true, not false - even though it does have content.

The snippet above is its own partial, referenced from within a get.

kolber commented 12 years ago

This is due to a bug in the old template parser. The new templating system which runs on Twig should does not have this issues.

Alternatively, you can get around it with some creative partial use, placing the two if statements inside a partial should do the trick.

thor commented 12 years ago

Ah, fair enough - sounds good. I'll give that a try and see how it goes.

May I come with a little off topic question: what's the status on 3.0/trunk - what level of stability/usability is there at the moment?

kolber commented 12 years ago

3.0 is stable, so completely ready to use. The documentation is not yet 100% updated, but it should be fairly easy to understand the differences.

The wiki is your best source of reference until the site is updated.