Having trouble with StaticFile object and output
fcassirer opened this issue · comments
I am getting faults from indexer.rb when trying to process JekyllStaticFile objects. Specifically, on this line:
137: items.select! {|i| output_ext(i) == '.html' && ! @excludes.any? {|s| (i.url =~ Regexp.new(s)) != nil } } which calls def output_ext(doc) if doc.is_a?(Jekyll::Document) Jekyll::Renderer.new(@site, doc).output_ext else doc.output_ext end end
The problem appears to be that there are some Static files that do not have the output_ext method: and doc.output_ext raises an exception.
Note that the static file is a .PNG file (I put this in the excludes in my _config.yml, but that doesn't seem to work ...)
If I ignore the exception, it fails later on some creates. It appears that there have been changes in Jekyll 3.0.0 (I'm using 3.0.1 but it fails the same in 3.0.0) around the handling of the output_ext, but it isn't clear if this is the cause.
The 2nd exception is:
search_entry.rb:16:in `create': Not supported (RuntimeError)
Again, the object for 'page_or_post' is a Jekyll::StaticFile
Am I missing something basic?
Thanks in advance for any insight.
-Fred
A closer look from a debug session:
first, list out the items variable: [3] pry(#Jekyll::LunrJsSearch::Indexer)> items Jekyll:Page @name="404.md", Jekyll:Page @name="about.md", ... Jekyll::Document _design/simon/simon_design.md collection=design, ... Jekyll::StaticFile:0x00000003682790 ... Jekyll::StaticFile does NOT have an output_ext method [3] ls items[28] Jekyll::StaticFile#methods: defaults destination_rel_dir modified? mtime placeholders to_liquid url write? destination extname modified_time path relative_path type write instance variables: @base @collection @dir @extname @name @relative_path @site class variables: @@mtimes Jekyll::Documents has a output_ext method [4] pry(#)> ls items[27] Comparable#methods: < <= == > >= between? Jekyll::Document#methods: <=> collection extname next_doc populate_categories relative_path trigger_hooks [] content generate_excerpt? output populate_tags render_with_liquid? url asset_file? content= id output= post_read respond_to? url_placeholders basename data inspect output_ext previous_doc sass_file? url_template basename_without_ext date merge_data! path published? site write cleaned_relative_path destination merged_file_read_opts permalink read to_liquid write? coffeescript_file? excerpt_separator method_missing place_in_layout? related_posts to_s yaml_file? instance variables: @basename @cleaned_relative_path @content @extname @output_ext @relative_path @to_liquid @basename_without_ext @collection @data @has_yaml_header @path @site @url [5] pry(#)> ls items[0] Jekyll::Convertible#methods: [] converters invalid_layout? place_in_layout? render_all_layouts sass_file? transform asset_file? do_layout merged_file_read_opts published? render_liquid to_liquid type coffeescript_file? hook_owner output_ext read_yaml render_with_liquid? to_s write Jekyll::Page#methods: basename content data destination dir= ext= index? name output pager path process render site= url basename= content= data= dir ext html? inspect name= output= pager= permalink relative_path site template url_placeholders instance variables: @base @basename @content @converters @data @dir @ext @name @site @url
I think I just created a fix for this as I saw the same issue