Jekyll Variable' {{'使用正则表达式未正确终止:/ \} \}

时间:2016-05-12 13:21:12

标签: jekyll

在发布标记时,我使用{{上的双括号jekyll 2.5.3返回错误:

Jekyll Variable '{{' was not properly terminated with regexp: /\}\}

内容替换为:

<article class="post-content">
    {{ content }}
</article>
模板中的

当我从邮政标记中删除此行时,它完全有效:

`{{` **Double Curly Braces** indicate that data will be replaced with data binding

为什么会这样?

更新

堆栈追踪:

/var/lib/gems/1.9.1/gems/liquid-2.6.1/lib/liquid/block.rb:78:in `create_variable': Variable '{{' was not properly terminated with regexp: /\}\}/  (Liquid::SyntaxError)
    from /var/lib/gems/1.9.1/gems/liquid-2.6.1/lib/liquid/block.rb:38:in `parse'
    from /var/lib/gems/1.9.1/gems/liquid-2.6.1/lib/liquid/document.rb:5:in `initialize'
    from /var/lib/gems/1.9.1/gems/liquid-2.6.1/lib/liquid/template.rb:59:in `new'
    from /var/lib/gems/1.9.1/gems/liquid-2.6.1/lib/liquid/template.rb:59:in `parse'
    from /var/lib/gems/1.9.1/gems/liquid-2.6.1/lib/liquid/template.rb:46:in `parse'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/convertible.rb:106:in `render_liquid'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/convertible.rb:233:in `do_layout'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/post.rb:261:in `render'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/site.rb:298:in `block in render'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/site.rb:297:in `each'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/site.rb:297:in `render'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/site.rb:51:in `process'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/command.rb:28:in `process_site'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:56:in `build'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:34:in `process'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
    from /var/lib/gems/1.9.1/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from /var/lib/gems/1.9.1/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /var/lib/gems/1.9.1/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /var/lib/gems/1.9.1/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /var/lib/gems/1.9.1/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /var/lib/gems/1.9.1/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /var/lib/gems/1.9.1/gems/jekyll-2.5.3/bin/jekyll:20:in `<top (required)>'
    from /usr/local/bin/jekyll:23:in `load'
    from /usr/local/bin/jekyll:23:in `<main>'

1 个答案:

答案 0 :(得分:0)

您需要将该行包装在{% raw %} / {% endraw %}标记中,以阻止它被液体模板引擎处理。

{% raw %}
`{{` **Double Curly Braces** indicate that data will be replaced with data binding
{% endraw %}