Method: NanDoc::DataSource#items

Defined in:
lib/nandoc/hacks/data-source.rb

#itemsObject

Hack the items returned by this datasource object to include also files outside of the <my-site>/content directory, e.g. README.md or README/*/, NEWS.md, based on settings in the config.

Rescue orphan nodes with no parent page somehow.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/nandoc/hacks/data-source.rb', line 57

def items
  _ = Nanoc3::Item # autoload it now for easier step debug-ging
  these = super
  dot_dot_names = @basenames.map{|x| "../#{x}"}
  @hax_mode = true
  additional = dot_dot_names.map do |basename|
    if File.file?(basename) # was different
      load_objects(basename, 'item', Nanoc3::Item)
    else
      load_objects(basename, 'item', Nanoc3::Item)
    end
  end.compact.flatten(1)
  @hax_mode = false
  error_for_no_files(dot_dot_names) if additional.empty?
  res = these + additional
  orphan_rescue(res)
  res
end