manunamz / jekyll-wikilinks

Add [[wikilinks]] support for jekyll.
https://rubygems.org/gems/jekyll-wikilinks
GNU General Public License v3.0
37 stars 1 forks source link

undefined method `downcase' for nil:NilClass #28

Open stefanfritsch opened 2 years ago

stefanfritsch commented 2 years ago

Hi,

I'm trying to use this plugin on a foam wiki but I get the above error. I'm a raw newbie when it comes to jekyll so it is very well possible that it is my fault (looking at the code it's looking for a page title?), but you might prepend a to_s to downcase to catch nil cases.

/usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/util/parser.rb:133:in `build_html': undefined method `downcase' for nil:NilClass (NoMethodError)
    from /usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/util/parser.rb:83:in `block in parse_inlines'
    from /usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/util/parser.rb:80:in `each'
    from /usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/util/parser.rb:80:in `parse_inlines'
    from /usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/util/parser.rb:32:in `parse'
    from /usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/plugins/generator.rb:27:in `block in generate'
    from /usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/plugins/generator.rb:25:in `each'
    from /usr/local/bundle/gems/jekyll-wikilinks-0.0.8/lib/jekyll-wikilinks/plugins/generator.rb:25:in `generate'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/site.rb:193:in `block in generate'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/site.rb:191:in `each'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/site.rb:191:in `generate'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/site.rb:79:in `process'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/command.rb:28:in `process_site'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/commands/build.rb:65:in `build'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/commands/build.rb:36:in `process'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `each'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
    from /usr/local/bundle/gems/jekyll-4.2.1/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
    from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
    from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
    from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
    from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
    from /usr/local/bundle/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
    from /usr/local/bundle/gems/jekyll-4.2.1/exe/jekyll:15:in `<top (required)>'
    from /usr/local/bundle/bin/jekyll:25:in `load'
    from /usr/local/bundle/bin/jekyll:25:in `<top (required)>'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/cli/exec.rb:58:in `load'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/cli/exec.rb:58:in `kernel_load'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/cli/exec.rb:23:in `run'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/cli.rb:478:in `exec'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/cli.rb:31:in `dispatch'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/cli.rb:25:in `start'
    from /usr/local/bundle/gems/bundler-2.2.32/exe/bundle:49:in `block in <top (required)>'
    from /usr/local/bundle/gems/bundler-2.2.32/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
    from /usr/local/bundle/gems/bundler-2.2.32/exe/bundle:37:in `<top (required)>'
    from /usr/local/bundle/bin/bundle:23:in `load'
    from /usr/local/bundle/bin/bundle:23:in `<main>'
manunamz commented 2 years ago

Try explicitly defining a title in the frontmatter of your markdown files. Let me know if that fixes it.

That shouldn't be necessary though...(Jekyll should be generating titles on its own...🤔)

manunamz commented 2 years ago

Ok, I added some fallbacks in 0.0.11. Everything will probably work regardless if a title is defined as a frontmatter attribute or not.