如何在中间人的部分中渲染部分
我有一些Haml部分,其中许多包含样板
.container .row .col-lg-12
当我尝试将ala = partial "site_section"
抽象出来时,我得到:
syntax error, unexpected keyword_end, expecting end-of-input end;end;end;end
我正在使用ruby 2.2.2。
如何在Middleman的Haml部分内渲染Haml?
谢谢
更新这显然是某种特殊情况处理我的部分(上图)。 我还有其他部分内部渲染效果很好。
更新关于这个回购 ,布局实际上是:
_site_section:
.container .row .col-lg-12
_nested_section:
= partial "site_section" MOAR (nested) HAML
index.haml:
=partial "nested_section"
由于HAML的工作方式,以下内容无效:
= partial "site_section" MOAR (nested) HAML
如果您想添加更多文本或HAML,那么您可以通过将文本放在上一行的相同级别来实现它
= partial "site_section" MOAR (nested) HAML
或者将它嵌套在div中:
= partial "site_section" .more MOAR (nested) HAML
因此,如果您要做的是将额外的HAML嵌套到site_section partial的输出中,那么您必须将嵌套的额外HAML放在嵌套的部分中:
.container .row .col-lg-12 = partial 'nested_stuff' = partial 'nested_stuff'
希望这有帮助,我用工作示例更新了回购 。