jekyll-pandoc-multiple-formats icon indicating copy to clipboard operation
jekyll-pandoc-multiple-formats copied to clipboard

undefined method `matches` for #<Jekyll::Converters::Markdown:0x00000001d9e4e0> (NoMethodError)

Open lingnand opened this issue 11 years ago • 19 comments

I'm using a Octopress+Jekyll setup and placed pandoc.rb under <web-directory>/plugins; I've changed _config.yml as suggested in readme.md.

But as soon as I run jekyll build I get the following

Configuration from /home/lingnan/Dropbox/lynnard.github.com/_config.yml Building site: source -> build /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:62:in block in converter': undefined methodmatches' for #Jekyll::Converters::Markdown:0x00000001d9e4e0 (NoMethodError) from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:62:in each' from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:62:infind' from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:62:in converter' from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:54:inoutput_ext' from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/page.rb:145:in html?' from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:300:inblock in site_payload' from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:300:in reject' from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:300:insite_payload' from /home/lingnan/Dropbox/lynnard.github.com/plugins/pagination.rb:33:in paginate' from /home/lingnan/Dropbox/lynnard.github.com/plugins/pagination.rb:14:inblock in generate' from /home/lingnan/Dropbox/lynnard.github.com/plugins/pagination.rb:13:in `each'

lingnand avatar Jul 30 '13 07:07 lingnand

hmmm have you tried with a newer jekyll? i don't remember which version we were using when we started but now we're on jekyll 1.0+

fauno avatar Jul 30 '13 16:07 fauno

It works with jekyll 1.0.0 here.. haven't tried with an older version.

mauriciopasquier avatar Jul 30 '13 18:07 mauriciopasquier

mhh I'm using it with Octopress and Octopress is using a jekyll of version 0.12 and that might be where the problem comes from. Tried to tell Octopress to use a higher version, but that would break the whole thing. Guess this plugin is not compatible with Octopress...

lingnand avatar Jul 31 '13 06:07 lingnand

It seems so... Octopress' tasks use jekyll's old switch style instead of subcommands. Maybe it's easy to patch it, maybe not.

Anyway, I think I can make this plugin backwards compatible..

mauriciopasquier avatar Jul 31 '13 17:07 mauriciopasquier

@lynnard please test again with branch 'fix-3' from this repo.

mauriciopasquier avatar Jul 31 '13 18:07 mauriciopasquier

Thanks for your effort! There're still some issues though.

## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/lingnan/Dropbox/lynnard.github.com/_config.yml
Building site: source -> public
/home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:7:in `generate': undefined method `[]' for nil:NilClass (NoMethodError)
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:190:in `block in generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `each'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:40:in `process'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
        from /home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `load'
        from /home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `<main>'

lingnand avatar Jul 31 '13 19:07 lingnand

At least now it's in the Generator and not the Converter :P

Are you sure you have a pandoc key in _/home/lingnan/Dropbox/lynnard.github.com/_config.yml? Could you shows that file?

mauriciopasquier avatar Jul 31 '13 19:07 mauriciopasquier

Somehow I thought it would be a good idea to test without my config changed first, so all the previous error info is in fact produced by calling rake generate just after placing the pandoc.rb in my plugins directory.

After making the necessary changes to _config.yml there pops an entire different list of errors

Creating markdown/blog/2013/07/30
pandoc --smart --bibliography=ref.bib -t markdown -o markdown/blog/2013/07/30/the-very-first-blog-post/ 
Creating markdown/blog/2013/07/31
pandoc --smart --bibliography=ref.bib -t markdown -o markdown/blog/2013/07/31/ren-xing-zhi-shang/ 
Invalid Markdown processor: pandoc
  Valid options are [ maruku | rdiscount | kramdown ]
Liquid Exception: Invalid Markdown process: pandoc in atom.xml
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/converters/markdown.rb:87:in `setup'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/converters/markdown.rb:102:in `convert'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/filters.rb:25:in `markdownify'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/context.rb:58:in `invoke'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/variable.rb:43:in `block in render'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `each'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `inject'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `render'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/block.rb:94:in `block in render_all'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `collect'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `render_all'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/tags/for.rb:116:in `block (2 levels) in render'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/tags/for.rb:104:in `each'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/tags/for.rb:104:in `each_with_index'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/tags/for.rb:104:in `block in render'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/context.rb:91:in `stack'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/tags/for.rb:103:in `render'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/block.rb:94:in `block in render_all'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `collect'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `render_all'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/block.rb:82:in `render'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/template.rb:124:in `render'
/home/lingnan/.gem/ruby/2.0.0/gems/liquid-2.3.0/lib/liquid/template.rb:132:in `render!'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:79:in `do_layout'
/home/lingnan/Dropbox/lynnard.github.com/plugins/post_filters.rb:167:in `do_layout'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/page.rb:100:in `render'
/home/lingnan/Dropbox/lynnard.github.com/plugins/category_generator.rb:100:in `write_category_index'
/home/lingnan/Dropbox/lynnard.github.com/plugins/category_generator.rb:111:in `block in write_category_indexes'
/home/lingnan/Dropbox/lynnard.github.com/plugins/category_generator.rb:110:in `each'
/home/lingnan/Dropbox/lynnard.github.com/plugins/category_generator.rb:110:in `write_category_indexes'
/home/lingnan/Dropbox/lynnard.github.com/plugins/category_generator.rb:139:in `generate'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:190:in `block in generate'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `each'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `generate'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:40:in `process'
/home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
/home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `load'
/home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `<main>'
Build Failed

Here's the relevant parts from my _config.yml

# ----------------------- #
#    Jekyll & Plugins     #
# ----------------------- #

# If publishing to a subdirectory as in http://site.com/project set 'root: /project'
root: /
permalink: /blog/:year/:month/:day/:title/
source: source
destination: public
plugins: plugins
code_dir: downloads/code
category_dir: blog/categories
markdown: pandoc
#rdiscount:
  #extensions:
    #- autolink
    #- footnotes
    #- smart
pandoc: 
    skip: false
    flags: '--smart --bibliography=ref.bib'
    site_flags: '--toc'
    outputs:
        pdf: '--latex-engine=latex'
        epub:
        markdown:
pygments: false # default python pygments have been replaced by pygments.rb
pygments: false # default python pygments have been replaced by pygments.rb

paginate: 10          # Posts per page on the blog index
pagination_dir: blog  # Directory base for pagination URLs eg. /blog/page/2/
recent_posts: 5       # Posts in the sidebar Recent Posts section
excerpt_link: "Read on &rarr;"  # "Continue reading" link text at the bottom of excerpted articles

titlecase: true       # Converts page and post titles to titlecase

# list each of the sidebar modules you want to include, in the order you want them to appear.
# To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
default_asides: [asides/recent_posts.html, asides/github.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html]

# Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below
# and add an array with the asides you want to use.
# blog_index_asides:
# post_asides:
# page_asides:

lingnand avatar Jul 31 '13 19:07 lingnand

ehr... didn't meant to close the issue :|

fauno avatar Aug 01 '13 14:08 fauno

@lynnard sorry that it took so long. Could you try again with this file? I think I got the problem.

mauriciopasquier avatar Aug 16 '13 05:08 mauriciopasquier

Unfortunately I'm presented with this error

## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/lingnan/Dropbox/lynnard.github.com/_config.yml
Building site: source -> public
Creating pdf/blog/2013/07/30
pandoc --smart --bibliography=ref.bib -o pdf/blog/2013/07/30/the-very-first-blog-post/ --latex-engine=latex
/home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:49:in `write': Broken pipe (Errno::EPIPE)
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:49:in `puts'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:49:in `block (3 levels) in generate'
        from /usr/lib/ruby/2.0.0/open3.rb:217:in `popen_run'
        from /usr/lib/ruby/2.0.0/open3.rb:99:in `popen3'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:48:in `block (2 levels) in generate'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:15:in `each'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:15:in `block in generate'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:10:in `each_pair'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:10:in `generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:190:in `block in generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `each'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:40:in `process'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
        from /home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `load'
        from /home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `<main>'

On 15/08, Mauricio Pasquier Juan wrote:

@lynnard sorry that it took so long. Could you try again with this file? I think I got the problem.


Reply to this email directly or view it on GitHub: https://github.com/fauno/jekyll-pandoc-multiple-formats/issues/3#issuecomment-22748229

Lingnan Dai

lingnand avatar Aug 16 '13 06:08 lingnand

I think it throws that error when it can't find a file. So that means your old jekyll did find the plugin this time :)

Do you have that ref.bib file that is configured here?

flags: '--smart --bibliography=ref.bib'

If not, remove the --bibliography option and try again, please. If that doesn't solve it, I've had some troubles with non-default (by jekyll standards) source, layouts and plugins locations. Maybe it's that.

mauriciopasquier avatar Aug 16 '13 06:08 mauriciopasquier

pandoc --smart --bibliography=ref.bib -o pdf/blog/2013/07/30/the-very-first-blog-post/ --latex-engine=latex

the -o flag requires a file with the correct extension, it's being passed a directory. i think the problem is with permalinks now.

fauno avatar Aug 16 '13 11:08 fauno

@lynnard could you try the hotfix/issue-3 branch?

fauno avatar Aug 16 '13 18:08 fauno

Mmh...Now is this

$ rake generate
 ## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/lingnan/Dropbox/lynnard.github.com/_config.yml
Building site: source -> public
Creating /home/lingnan/Dropbox/lynnard.github.com/source/pdf/blog/2013/07/30
pandoc --smart --bibliography=ref.bib -o /home/lingnan/Dropbox/lynnard.github.com/source/pdf/blog/2013/07/30/-blog-2013-07-30-the-very-first-blog-post.pdf --latex-engine=latex
/home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:56:in `write': Broken pipe (Errno::EPIPE)
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:56:in `puts'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:56:in `block (3 levels) in generate'
        from /usr/lib/ruby/2.0.0/open3.rb:217:in `popen_run'
        from /usr/lib/ruby/2.0.0/open3.rb:99:in `popen3'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:55:in `block (2 levels) in generate'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:18:in `each'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:18:in `block in generate'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:10:in `each_pair'
        from /home/lingnan/Dropbox/lynnard.github.com/plugins/pandoc.rb:10:in `generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:190:in `block in generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `each'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `generate'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/lib/jekyll/site.rb:40:in `process'
        from /home/lingnan/.gem/ruby/2.0.0/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
        from /home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `load'
        from /home/lingnan/.gem/ruby/2.0.0/bin/jekyll:23:in `<main>'

lingnand avatar Aug 17 '13 12:08 lingnand

Hi, any update on this problem? I think I should as well look into the code myself, but I haven't got time to whip up my ruby skills.

lingnand avatar Oct 09 '13 22:10 lingnand

hey! sorry to keep you waiting, could you try with a more modern jekyll? i just saw you're using 0.12

fauno avatar Nov 20 '13 16:11 fauno

I use jekyll 2.2.0, and the error message like this:

zepu@zepu-thinkpad-e420:~/Twenty-Jekyll-Theme$ jekyll -v

jekyll 2.2.0

use jekyll:

zepu@zepu-thinkpad-e420:~/Twenty-Jekyll-Theme$ jekyll serve

Configuration file: /home/zepu/Twenty-Jekyll-Theme/_config.yml
            Source: /home/zepu/Twenty-Jekyll-Theme
       Destination: /home/zepu/Twenty-Jekyll-Theme/_site
      Generating... 
  Conversion error: There was an error converting '_posts/2014-08-07-first-post.markdown/#excerpt'.
jekyll 2.2.0 | Error:  undefined method `keys' for nil:NilClass

I try to update jekyll zepu@zepu-thinkpad-e420:~/Twenty-Jekyll-Theme$ gem update jekyll

Updating installed gems
Nothing to update

xizepu avatar Oct 25 '15 17:10 xizepu

@XiZepu i don't know why i don't get email notifications, sorry i never replied! :/

i think we fixed your issue a while ago, it had to do with excerpts being included on the yaml metadata but actually being a ruby object, so we skipped it

fauno avatar Aug 05 '17 15:08 fauno