jekyll-pdf icon indicating copy to clipboard operation
jekyll-pdf copied to clipboard

Infinite loop in generator causes jekyll build to hang indefinitely

Open mdaizcorbe opened this issue 8 years ago • 4 comments

The following line in generator.rb causes an infinite loop since it is appending an item to the array it is iterating on that meets the condition:

site.pages << Document.new(site, site.source, item) if item.data['pdf']

I found that prepending the item instead seemed to have the desired effect.

mdaizcorbe avatar Mar 31 '17 13:03 mdaizcorbe

What version of Ruby, Jekyll etc. are you using? This plugin is in use on client websites right now and working...

I have been meaning to release a new version using hooks instead of a generator, just haven't gotten around to it yet.

abemedia avatar Mar 31 '17 14:03 abemedia

I'm using the following on Windows 7: ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32] jekyll 3.1.6

I'm not sure what the difference is between site.pages and site.documents but I could imagine if the content to be put into the pdf is in site.documents then this wouldn't be an issue.

mdaizcorbe avatar Mar 31 '17 16:03 mdaizcorbe

I am also experiencing this issue when trying to generate a PDF for a page

ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16] Jekyll 3.4.3

There seems to be a fix for this in one of the forks https://github.com/magento-mcom/jekyll-pdf/commit/f6b6f9a439a18c8ca61d2abdb773f9ad4349a869

lexhl avatar Apr 07 '17 13:04 lexhl

see https://github.com/abeMedia/jekyll-pdf/issues/24

it also contains mlenkeit's fix for this issue

hoijui avatar Jun 29 '19 07:06 hoijui