Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jekyll 3.0.0-beta1/Liquid 3 Issue with Handlebars highlighting #3557

Closed
KevinGimbel opened this issue Mar 9, 2015 · 8 comments
Closed

Jekyll 3.0.0-beta1/Liquid 3 Issue with Handlebars highlighting #3557

KevinGimbel opened this issue Mar 9, 2015 · 8 comments

Comments

@KevinGimbel
Copy link

After upgrading to Jekyll 3.0.0-beta1 I get the following Liquid Error for one of my posts:

jekyll 3.0.0-beta1 | Error:  Liquid syntax error: Unexpected character # in "{{#post}}"

The specific part of the post is the following:

{% highlight html %}
{% raw %}
{{#post }}
  <article class="post">
    <hgroup>
      <h2>{{{title}}}</h2>
      {{#if author}}
        written by {{author.name}}
      {{/if}}
    </hgroup>
  </article>
{{/post}}
{% endraw %}
{% endhighlight %}

I used the {% raw %} tags here to prevent Jekyll/Liquid from parsing the Handelbars code snippet. Now with the latest version of either Liquid or Jekyll this seems to not work anymore and I can't build my site.

I couldn't find a open issue or a temporary workaround for this. Any ideas how to prevent this?

Additional info:

Ruby Version: ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-linux]
OS: Ubuntu 14.04
Jekyll: 3.0.0-beta1
Repo: https://github.com/kevingimbel/kevingimbel.github.io
Post with Issue: https://github.com/kevingimbel/kevingimbel.github.io/blob/master/_posts/2013-10-16-ghost-in-the-shell.md

@envygeeks
Copy link
Contributor

Can you please try with beta2 and confirm it's still broken there so we can block the next beta?

@KevinGimbel
Copy link
Author

When I use the beta2 release I get the following Errors:

  Build Warning: Layout 'nil' requested in article.json does not exist.
  Build Warning: Layout 'nil' requested in atom.xml does not exist.
  Liquid Exception: Liquid syntax error: Expected end_of_string but found pipe in "post in site.posts | limit: 10" in _layouts/front-page.html

So with this release it seems that limits are broken. The Error with Raw Tags and Handlebars Syntax are still present unfortunately.

Affected file: https://github.com/kevingimbel/kevingimbel.github.io/blob/master/_layouts/front-page.html#L8
Jekyll Version: 3.0.0.beta2

@envygeeks
Copy link
Contributor

Can you please file a unique bug for that one and attach it to this ticket by ref-ing it.

@parkr
Copy link
Member

parkr commented Mar 9, 2015

Is this fixed?

@envygeeks
Copy link
Contributor

Not that I know of, it still existed in beta2? If he doesn't respond I'll test and see tonight.

@parkr
Copy link
Member

parkr commented Mar 9, 2015

Plot twist. This works:

require 'liquid'
require "#{ENV['HOME']}/jekyll/jekyll/lib/jekyll.rb"

class SomeSite
  def safe
    true
  end

  def highlighter
    'pygments'
  end
end

content = <<-EOS
{% highlight html %}
{% raw %}
{{#post}}
  <article class="post">
    <hgroup>
      <h2>{{{title}}}</h2>
      {{#if author}}
        written by {{author.name}}
      {{/if}}
    </hgroup>
  </article>
{{/post}}
{% endraw %}
{% endhighlight %}
EOS

puts Liquid::Template.parse(content).render({}, { :registers => { :site => SomeSite.new } })

@chrisfinazzo
Copy link
Contributor

@parkr,

Does that fix the build warning? At least for the feed template I'm using (one of TPW's originals, IIRC), you need to pass null to get around any errors. This has come up a few times if memory serves - #2712 and #2730 - as well as some I've probably forgotten about.

@parkr
Copy link
Member

parkr commented Mar 10, 2015

@chrisfinazzo Indeed, thanks! Your layout should be null instead of nil if you want no layout.

Looks like we fixed your other issue before in #3559.

@parkr parkr closed this as completed Mar 10, 2015
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants