2016-04-29 4 views
2

外部タグに複数の兄弟の液体タグが含まれている場合、コンパイルするためにネストされた液体タグを取得することに問題があります。これは動作します:ネストされた液体カスタムタグブロック

{% container %} 
    {% inner %} 
    Stuff Goes in here 
    {% endinner %} 
{% endcontainer %} 

が、これがないではない

{% container %} 
    {% inner %} 
    Stuff Goes in here 
    {% endinner %} 
    {% inner %} 
    Stuff Goes in here 
    {% endinner %} 
{% endcontainer %} 

私は次のエラーを取得する:

Liquid Exception: Liquid syntax error (line 1): 'container' tag was never closed in /.../_posts/blah.markdown/#excerpt 
Liquid Exception: Liquid syntax error (line 1): 'container' tag was never closed in _includes/head.html, included in _layouts/default.html 

お知らせ最初のエラーで#excerptこと?私は前の問題に抜粋を追加する場合。すべてうまく動作します。

<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}"> 

エラーがあまりにも離れて行くようになります頭の中にif文を削除:私head.html含めるには、新しいジキルサイトとデフォルトの一つです。私は、なぜ複数の兄弟がこのエラーの原因になるのかについて完全に混乱しています。ここに私の簡素化プラグインのコードは次のとおりです。

module Jekyll 
    class RenderContainer < Liquid::Block 

    def initialize(tag_name, contain, tokens) 
     super 
    end 

    def render(context) 
     "<div class=\"container\">#{super}</div>" 
    end 
    end 

    class RenderInner < Liquid::Block 
    def initialize(tag_name, contain, tokens) 
     super 
    end 

    def render(context) 
     "<div class=\"inner\">#{super}</div>" 
    end 
    end 
end 

Liquid::Template.register_tag('container', Jekyll::RenderContainer) 
Liquid::Template.register_tag('inner', Jekyll::RenderInner) 

答えて

0

私はちょうど同じ問題に遭遇したと明らかにこれはknown bugです。私はあなたのプラグインとあなたが上記の仕事を得ることができない液体のタグ試してみました:

{% container %} 
    {% inner %} 
    Stuff Goes in here 
    {% endinner %} 
    {% inner %} 
    Stuff Goes in here 
    {% endinner %} 
{% endcontainer %} 

を...と私は私のconfig.ymlに推奨修正を(下記参照)を加えた後、コードはその後働いていました。

excerpt_separator: "" 

このビットを設定ファイルに追加した後は、必ずJekyll serveを再起動してください。

+1

ニース!ほとんど一年前の質問にお返事いただきありがとうございます! – jhummel

関連する問題