robwierzbowski / jekyll-image-tag

Better images for Jekyll.
BSD 3-Clause "New" or "Revised" License
98 stars 26 forks source link

Syntax error, undefined sequence #8

Closed wesleymiller closed 10 years ago

wesleymiller commented 11 years ago

I've installed all the requirements for the jekyll image tag plugin but when I build my site I receive an error message and no files are created.

I don't think it's an issue with the plugin. I'm a Ruby-Newbie, and I don't know how to interpret the error. Hopefully you can point me in the right direction.

Error message is posted below:

MacBook-Pro:wesleymiller.com wesleymiller$ jekyll build
Configuration file: /Users/wesleymiller/Dropbox/Sites/wesleymiller.com/_config.yml
/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require': /Users/wesleymiller/Dropbox/Sites/wesleymiller.com/_plugins/image_tag.rb:39: undefined (?...) sequence: /^(?:(?<preset>[^\s.:\/]+)\s+)?(?<image_src>[^\s]+\.[a-zA-Z0-9]{3,4})\s*(?<html_attr>[\s\S]+)?$/ (SyntaxError)
/Users/wesleymiller/Dropbox/Sites/wesleymiller.com/_plugins/image_tag.rb:58: undefined (?...) sequence: /^(?:(?<width>\d+)|auto)(?:x)(?:(?<height>\d+)|auto)$/
/Users/wesleymiller/Dropbox/Sites/wesleymiller.com/_plugins/image_tag.rb:70: undefined (?...) sequence: /(?<attr>[^\s="]+)(?:="(?<value>[^"]+)")?\s?/
    from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/site.rb:77:in `setup'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/site.rb:76:in `each'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/site.rb:76:in `setup'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/site.rb:75:in `each'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/site.rb:75:in `setup'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/site.rb:26:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/commands/build.rb:5:in `new'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/../lib/jekyll/commands/build.rb:5:in `process'
    from /Library/Ruby/Gems/1.8/gems/jekyll-1.2.1/bin/jekyll:73
    from /Library/Ruby/Gems/1.8/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/1.8/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/1.8/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
    from /Library/Ruby/Gems/1.8/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
    from /Library/Ruby/Gems/1.8/gems/commander-4.1.5/lib/commander/runner.rb:66:in `run!'
    from /Library/Ruby/Gems/1.8/gems/commander-4.1.5/lib/commander/delegates.rb:7:in `run!'
    from /Library/Ruby/Gems/1.8/gems/commander-4.1.5/lib/commander/import.rb:10
    from /usr/bin/jekyll:23
MacBook-Pro:wesleymiller.com wesleymiller$ 

Thanks.

wesleymiller commented 11 years ago

UPDATE: I did some more digging and updated Ruby (I was using the version that comes with OSX) to 2.0 and got around the above error. Didn't immediately run correctly, but I tweaked the config file and now it works perfectly!

Sorry to clutter up your page with my learning curve. :)

robwierzbowski commented 11 years ago

No problem! Can you post the config file differences?

On Sunday, October 13, 2013, wesleymiller wrote:

UPDATE: I did some more digging and updated Ruby (I was using the version that comes with OSX) to 2.0 and got around the above error. Didn't immediately run correctly, but I tweaked the config file and now it works perfectly!

Sorry to clutter up your page with my learning curve. :)

— Reply to this email directly or view it on GitHubhttps://github.com/robwierzbowski/jekyll-image-tag/issues/8#issuecomment-26211573 .

Rob Wierzbowski @robwierzbowski http://twitter.com/#!/robwierzbowski http://github.com/robwierzbowski http://robwierzbowski.com

wesleymiller commented 11 years ago

Sure, I was on a different computer working on a different site, but here's the last few commands I ran:

imac:edwardhidden.com wesleymiller$ jekyll build
Configuration file: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_config.yml
            Source: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com
       Destination: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_site
      Generating...   Liquid Exception: No such file or directory - /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/assets/img/_fullsize/assets/img/test.jpg in index.md
done.

This was a bad path in the config file, but at this point I realized that it was working. I think at this point I just deleted everything in the config file to see what it would do by default. Then I got this:

imac:edwardhidden.com wesleymiller$ jekyll build
Configuration file: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_config.yml
            Source: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com
       Destination: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_site
      Generating...   Liquid Exception: undefined method `[]' for nil:NilClass in index.md
error: undefined method `[]' for nil:NilClass. Use --trace to view backtrace
imac:edwardhidden.com wesleymiller$ --trace
-bash: --trace: command not found
imac:edwardhidden.com wesleymiller$ jekyll build --trace
Configuration file: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_config.yml
            Source: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com
       Destination: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_site
      Generating...   Liquid Exception: undefined method `[]' for nil:NilClass in index.md
/Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_plugins/image_tag.rb:40:in `render': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/liquid-2.5.3/lib/liquid/block.rb:106:in `block in render_all'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/liquid-2.5.3/lib/liquid/block.rb:93:in `each'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/liquid-2.5.3/lib/liquid/block.rb:93:in `render_all'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/liquid-2.5.3/lib/liquid/block.rb:82:in `render'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/liquid-2.5.3/lib/liquid/template.rb:124:in `render'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/liquid-2.5.3/lib/liquid/template.rb:132:in `render!'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/convertible.rb:81:in `render_liquid'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/convertible.rb:139:in `do_layout'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/page.rb:115:in `render'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/site.rb:210:in `block in render'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/site.rb:208:in `each'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/site.rb:208:in `render'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/site.rb:36:in `process'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/command.rb:18:in `process_site'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/commands/build.rb:23:in `build'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/lib/jekyll/commands/build.rb:7:in `process'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/jekyll-1.2.1/bin/jekyll:73:in `block (2 levels) in <top (required)>'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/commander-4.1.5/lib/commander/runner.rb:78:in `run!'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/commander-4.1.5/lib/commander/delegates.rb:7:in `run!'
    from /Users/wesleymiller/.rvm/gems/ruby-2.0.0-p247/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'

After this I took the config file that came in the download with the plugin and changed the paths to match my setup. After that it built with no problem.

imac:edwardhidden.com wesleymiller$ jekyll build
Configuration file: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_config.yml
            Source: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com
       Destination: /Users/wesleymiller/Dropbox/Sites/edwardhidden.com/_site
      Generating... Generating test-864x650-023408.jpg
done.

So, I can't really explain what I did to fix it, but it works. This will get me where I need to go for now. I'm going to dive into Ruby and the command line to get a better understanding of everything.

robwierzbowski commented 10 years ago

Thanks for the report. I haven't had time to look at this closely, but it's on my todo list.

fregante commented 10 years ago

It looks like the issue is Ruby's version.

I updated Ruby from 1.8 to 1.9.2 and it worked.