jekyll-asciidoc: undefined method `nil_or_empty?' for String
Hello,
I’m trying to make Jekyll excerpts work, but I unfortunately come upon this trace:
Conversion error: Jekyll::AsciiDoc::Converter encountered an error while converting '_posts/2012-03-11-html5-still-a-non-event.adoc':
undefined method `nil_or_empty?' for #<String:0x007fa72f7dfdb0>
Liquid Exception: undefined method `nil_or_empty?' for #<String:0x007fa72f7dfdb0> in tag/html-5/index.html
/Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-asciidoc-2.0.1/lib/jekyll-asciidoc/converter.rb:207:in `convert': undefined method `nil_or_empty?' for #<String:0x007fa72f7dfdb0> (NoMethodError)
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:109:in `block in convert'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:107:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:107:in `reduce'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:107:in `convert'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:86:in `run'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/excerpt.rb:72:in `output'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/excerpt.rb:59:in `to_s'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/drops/document_drop.rb:22:in `excerpt'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/drops/drop.rb:52:in `public_send'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/drops/drop.rb:52:in `[]'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/context.rb:201:in `lookup_and_evaluate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/variable_lookup.rb:48:in `block in evaluate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/variable_lookup.rb:38:in `each_index'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/variable_lookup.rb:38:in `evaluate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/context.rb:168:in `evaluate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/context.rb:160:in `[]'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/condition.rb:101:in `interpret_condition'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/condition.rb:39:in `evaluate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/if.rb:38:in `block (2 levels) in render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/if.rb:37:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/if.rb:37:in `block in render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/context.rb:132:in `stack'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/if.rb:36:in `render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:151:in `render_token'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:5:in `block in render_token_with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler.rb:80:in `profile_token_render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:4:in `render_token_with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:135:in `block in render_all'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `render_all'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:108:in `render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:210:in `block in render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:262:in `with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:209:in `render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:222:in `render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:28:in `block (2 levels) in render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:40:in `measure_bytes'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:27:in `block in render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:47:in `measure_time'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:26:in `render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/tags/include.rb:138:in `block in render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/context.rb:132:in `stack'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/tags/include.rb:136:in `render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:151:in `render_token'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:5:in `block in render_token_with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler.rb:80:in `profile_token_render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:4:in `render_token_with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:135:in `block in render_all'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `render_all'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/for.rb:113:in `block (2 levels) in render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/for.rb:100:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/for.rb:100:in `each_with_index'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/for.rb:100:in `block in render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/context.rb:132:in `stack'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/tags/for.rb:99:in `render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:151:in `render_token'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:5:in `block in render_token_with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler.rb:80:in `profile_token_render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/profiler/hooks.rb:4:in `render_token_with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:135:in `block in render_all'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:122:in `render_all'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/block.rb:108:in `render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:210:in `block in render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:262:in `with_profiling'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:209:in `render'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/liquid-3.0.6/lib/liquid/template.rb:222:in `render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:28:in `block (2 levels) in render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:40:in `measure_bytes'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:27:in `block in render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:47:in `measure_time'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/liquid_renderer/file.rb:26:in `render!'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:134:in `render_liquid'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/renderer.rb:82:in `run'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/convertible.rb:211:in `do_layout'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/page.rb:135:in `render'
from /Users/i303869/projects/private/nfrankel.gitlab.io/_plugins/tags.rb:43:in `write_tag_index'
from /Users/i303869/projects/private/nfrankel.gitlab.io/_plugins/tags.rb:36:in `block in generate'
from /Users/i303869/projects/private/nfrankel.gitlab.io/_plugins/tags.rb:35:in `each'
from /Users/i303869/projects/private/nfrankel.gitlab.io/_plugins/tags.rb:35:in `generate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:174:in `block in generate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:172:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:172:in `generate'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/site.rb:68:in `process'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/command.rb:26:in `process_site'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/commands/build.rb:63:in `build'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/commands/build.rb:34:in `process'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/lib/jekyll/commands/serve.rb:37:in `block (2 levels) in init_with_program'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `call'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
from /Users/i303869/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-3.3.1/exe/jekyll:13:in `<top (required)>'
from /usr/local/bin/jekyll:22:in `load'
from /usr/local/bin/jekyll:22:in `<main>'
I’m using:
- Ruby 2.2.3
- Jekyll 3.3.1
- jekyll-asciidoctor plugin 2.0.1
Interestingly enough, it works if:
- Either I remove *.adoc files
- Or don’t try to write excerpts
Hints welcome, many thanks.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- resolves #142 don't call nil_or_empty? outside of an Asciidoctor context — committed to mojavelinux/jekyll-asciidoc by mojavelinux 7 years ago
- resolves #142 don't call nil_or_empty? outside of an Asciidoctor context (PR #169) — committed to asciidoctor/jekyll-asciidoc by mojavelinux 7 years ago
- add entry for #142 to CHANGELOG — committed to asciidoctor/jekyll-asciidoc by mojavelinux 6 years ago
I realize now why I couldn’t reproduce. I was loading asciidoctor-diagram, which was in turn loading Asciidoctor.
There are at least two ways to workaround the problem before I apply the patch.
:jekyll_plugins
group in your Gemfile:Long story, short, you need to force Asciidoctor to load eagerly to avoid this sort of problem.
@nfrankel I just tested with your blog and it fixes the error. I just added the following to the top of _plugins/tags.rb
One thing I noticed about that tags plugin is that it runs before the Jekyll AsciiDoc integrator runs. Therefore, the only metadata available at that time is metadata defined in the front matter. The information in the AsciiDoc document header is not yet seen. That’s okay in your case since you are defining all metadata in front matter. But it will be something we’ll have to sort out if others want to use the tags plugin with integrated AsciiDoc metadata.
Great! I’ll have a look.
I also think I understand now how to make excerpts work correctly…or at least I have an idea. But I need to test that theory.