Skip to content
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

Patching issue 29 #30

Merged
merged 5 commits into from
Jan 12, 2021
Merged

Patching issue 29 #30

merged 5 commits into from
Jan 12, 2021

Conversation

RobbiNespu
Copy link
Contributor

@RobbiNespu RobbiNespu commented May 11, 2020

  • using to_s method to returns string representation of an object

  • using unless l.nil? || l == 0 || (l.is_a? String) ... end filter string is not null, zero value or not string before ref <<

Submit as patch for #29

@lazee
Copy link
Owner

lazee commented May 25, 2020

@MaximeKjaer Do you have the time to take a quick look?

lazee
lazee previously approved these changes May 25, 2020
Copy link
Owner

@lazee lazee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks solid

Copy link
Collaborator

@MaximeKjaer MaximeKjaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for the delayed response. Could you provide a reproduction of the input that lead to l being nil? It Would be useful to have a test case for this.

@@ -52,7 +52,9 @@ def adder(content)
def load_references(content)
refs = ["\n"]
content.each_line do |l|
refs << l if l.strip!.match(/^\[.*\]:.*\".*\"$/i)
unless l.nil? || l == 0 || (l.is_a? String)
refs << l if l.to_s.strip!.match(/^\[.*\]:.*\".*\"$/i)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: this line needs to be indented

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RobbiNespu Could you provide what @MaximeKjaer asked for? I would also like to be able to reproduce this in some test cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaximeKjaer @lazee sorry, did't notice there is review msg on this. I re-indent that line as require

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RobbiNespu Great, but could you also provide an example of what caused this, so that we can add a test for it?

@lazee lazee dismissed their stale review June 16, 2020 06:13

We need to add tests.

@iranzo
Copy link

iranzo commented Nov 18, 2020

I got this today, but just adding a note:

> note ""
> No headers in here

And enabling 'premonition' as jekyll plugin in _config.yml

jekyll 3.9.0 | Error:  undefined method `match' for nil:NilClass
Traceback (most recent call last):
	30: from /usr/local/bundle/bin/jekyll:29:in `<main>'
	29: from /usr/local/bundle/bin/jekyll:29:in `load'
	28: from /usr/gem/gems/jekyll-3.9.0/exe/jekyll:15:in `<top (required)>'
	27: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	26: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	25: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	24: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	23: from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	22: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
	21: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `start'
	20: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `each'
	19: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/commands/serve.rb:93:in `block in start'
	18: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:36:in `process'
	17: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:65:in `build'
	16: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/command.rb:28:in `process_site'
	15: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/site.rb:71:in `process'
	14: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/site.rb:192:in `render'
	13: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/site.rb:471:in `render_pages'
	12: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/site.rb:471:in `each'
	11: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/site.rb:472:in `block in render_pages'
	10: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/site.rb:479:in `render_regenerated'
	 9: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/renderer.rb:60:in `run'
	 8: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/page.rb:180:in `trigger_hooks'
	 7: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/hooks.rb:102:in `trigger'
	 6: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/hooks.rb:102:in `each'
	 5: from /usr/gem/gems/jekyll-3.9.0/lib/jekyll/hooks.rb:103:in `block in trigger'
	 4: from /usr/gem/gems/premonition-4.0.0/lib/premonition/hook.rb:35:in `block in generate'
	 3: from /usr/gem/gems/premonition-4.0.0/lib/premonition/processor.rb:19:in `adder'
	 2: from /usr/gem/gems/premonition-4.0.0/lib/premonition/processor.rb:54:in `load_references'
	 1: from /usr/gem/gems/premonition-4.0.0/lib/premonition/processor.rb:54:in `each_line'
/usr/gem/gems/premonition-4.0.0/lib/premonition/processor.rb:55:in `block in load_references': undefined method `match' for nil:NilClass (NoMethodError)

@luispollo
Copy link

Ran in to this today as well. Any chance we can get this over the finish line, please?

@lazee
Copy link
Owner

lazee commented Jan 6, 2021

I will do some testing on this tonight.

@lazee
Copy link
Owner

lazee commented Jan 6, 2021

@iranzo @luispollo I'm having a hard time recreating the problem locally. I have tried with Jekyll 3.8.6, 3.9.0 and 4.2.0.

Hints on Ruby version, Jekyll version and setup would be highly appreciated.

This is the output I get from the example @iranzo sent.

image

@luispollo
Copy link

luispollo commented Jan 6, 2021

This is my setup:

root@9ef636a1e4be:/app# gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.3
  - RUBY VERSION: 2.5.8 (2020-03-31 patchlevel 224) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/bundle
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.5.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bundle/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/bundle
     - /root/.gem/ruby/2.5.0
     - /usr/local/lib/ruby/gems/2.5.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--no-document"
     - "update" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bundle/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
root@9ef636a1e4be:/app# gem info jekyll

*** LOCAL GEMS ***

jekyll (3.9.0)
    Author: Tom Preston-Werner
    Homepage: https://github.com/jekyll/jekyll
    License: MIT
    Installed at: /usr/local/bundle

    A simple, blog aware, static site generator.

@lazee
Copy link
Owner

lazee commented Jan 12, 2021

I've thrown away too much time on this now, so I guess we will just merge it in. I'm not able to recreate this problem with Jekyll 3.9.0. I don't see any harm in merging this in.

Copy link
Owner

@lazee lazee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though I'm not able to create I will allow it.

@lazee lazee merged commit a190f68 into lazee:master Jan 12, 2021
@lazee
Copy link
Owner

lazee commented Jan 12, 2021

@RobbiNespu @luispollo 4.0.1 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants