Coffeescript 嵌套if在eco模板引擎中不起作用

Coffeescript 嵌套if在eco模板引擎中不起作用,coffeescript,docpad,eco,Coffeescript,Docpad,Eco,我尝试在eco模板中使用嵌套if。这是我的密码 <% for document in @getCollection('posts').toJSON()[@document.page.startIdx...@document.page.endIdx]: %> <% if true %> <p> <%= new Date(document.date.toDateS

我尝试在eco模板中使用嵌套if。这是我的密码

<% for document in @getCollection('posts').toJSON()[@document.page.startIdx...@document.page.endIdx]: %>

                    <% if true %>

                        <p>  <%=  new Date(document.date.toDateString()).getTime() <= new Date(new Date().toDateString()).getTime() %> </p>


                        <div class='row-fluid'>
                            <div class='span12 blogShadow'>
                                <div class="row-fluid">
                                    <div class='span12 archiverow'>
                                        <span>(<%= document.date.toDateString() %>) => </span>
                                        <span>
                                            <a href="<%= document.url %>">   <%= document.title %> </a>
                                        </span>
                                    </div>
                                </div>
                                <div class="row-fluid archiverow">
                                    <% if document.img:%>
                                        <img class="span1" src="<%= document.img %>" width=100 height=100 />
                                        <span class="span11"><%= document.description %></span>
                                    <% else: %>
                                        <span class="span12"><%= document.description %></span>
                                    <% end %>
                                </div>
                            </div>
                        </div>
                    <% end %>
                    <br/>
                    <br/>
                <% end %>


“宽度=100高度=100/>


若我删除了first if及其相应的end语句,那个么一切正常,但若我把它放在带有消息unexpected dedent的解析错误中

下面的else语句

<% else: %>
                                        <span class="span12"><%= document.description %></span>
                                    <% end %>

我是eco的新手,我不理解这条信息。如果可能的话,这种嵌套是否可行?如果不可能,解决方法是什么

作为模板引擎,我使用docpad和eco


如果需要进一步的详细信息,请告诉我。

我可以通过以下代码解决问题。我缺少计算表达式的

<% for document in @getCollection('posts').toJSON()[@document.page.startIdx...@document.page.endIdx]: %>
                    <% if (new Date(document.date.toDateString()).getTime() <= new Date(new Date().toDateString()).getTime()): %>
                            <div class='row-fluid'>
                                <div class='span12 blogShadow'>
                                    <div class="row-fluid">
                                        <div class='span12 archiverow'>
                                            <span>(<%= document.date.toDateString() %>) => </span>
                                            <span>
                                                <a href="<%= document.url %>">   <%= document.title %> </a>
                                            </span>
                                        </div>
                                    </div>
                                    <div class="row-fluid archiverow">
                                        <% if document.img:%>
                                            <img class="span1" src="<%= document.img %>" width=100 height=100 />
                                            <span class="span11"><%= document.description %></span>
                                        <% else: %>
                                            <span class="span12"><%= document.description %></span>
                                        <% end %>
                                    </div>
                                </div>
                            </div>
                    <% end %>
                <% end %>

“宽度=100高度=100/>
两者都可以正常工作