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

Confusing `nil` error in highlight block #4173

Closed
timbertson opened this Issue Nov 22, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@timbertson
Contributor

timbertson commented Nov 22, 2015

I'm using jekyll 3.0.1 with liquid 3.0.6.

I'm trying to upgrade from an earlier version, and I'm getting:

$ bundle exec jekyll server --trace
  [ ... ]
  Liquid Exception: undefined method `t' for nil:NilClass in /home/tim/Sites/gfxmonk/_posts/2014/2014-04-25-escaping-an-array-of-command-line-arguments-in-csharp.md
/home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/block.rb:87:in `unknown_tag': undefined method `t' for nil:NilClass (NoMethodError)
    from /home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/block.rb:38:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/tag.rb:10:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/block.rb:31:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/tag.rb:10:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/document.rb:5:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/template.rb:122:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/liquid-3.0.6/lib/liquid/template.rb:108:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/liquid_renderer/file.rb:11:in `block in parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/liquid_renderer/file.rb:43:in `measure_time'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/liquid_renderer/file.rb:10:in `parse'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/renderer.rb:105:in `render_liquid'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/renderer.rb:60:in `run'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/site.rb:171:in `block (2 levels) in render'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/site.rb:169:in `each'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/site.rb:169:in `block in render'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/site.rb:168:in `each'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/site.rb:168:in `render'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/site.rb:59:in `process'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/command.rb:28:in `process_site'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/commands/build.rb:60:in `build'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/commands/build.rb:35:in `process'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/lib/jekyll/commands/serve.rb:26:in `block (2 levels) in init_with_program'
    from /home/tim/Sites/gfxmonk/_gems/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from /home/tim/Sites/gfxmonk/_gems/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /home/tim/Sites/gfxmonk/_gems/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /home/tim/Sites/gfxmonk/_gems/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /home/tim/Sites/gfxmonk/_gems/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /home/tim/Sites/gfxmonk/_gems/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /home/tim/Sites/gfxmonk/_gems/gems/jekyll-3.0.1/bin/jekyll:17:in `<top (required)>'
    from /home/tim/Sites/gfxmonk/_gems/bin/jekyll:23:in `load'
    from /home/tim/Sites/gfxmonk/_gems/bin/jekyll:23:in `<main>'

Looking at block.rb, it's failing on:

options[:locale].t("errors.syntax.unknown_tag".freeze, :tag => tag)

..because options[:locale] is evidently nil. This is because jekyll's HighlightBlock sets @options = {} after the super has run, overriding the actual options.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.