lib/nanoc/data_sources/filesystem_unified.rb in nanoc-3.8.0 vs lib/nanoc/data_sources/filesystem_unified.rb in nanoc-4.0.0a1

- old
+ new

@@ -64,10 +64,12 @@ # # It is possible to set an explicit encoding that should be used when reading # files. In the data source configuration, set `encoding` to an encoding # understood by Ruby’s `Encoding`. If no encoding is set in the configuration, # one will be inferred from the environment. + # + # @api private class FilesystemUnified < Nanoc::DataSource include Nanoc::DataSources::Filesystem private @@ -82,16 +84,16 @@ ext = params[:extension] || '.html' path = dir_name + (identifier == '/' ? '/index.html' : identifier[0..-2] + ext) parent_path = File.dirname(path) # Notify - Nanoc::NotificationCenter.post(:file_created, path) + Nanoc::Int::NotificationCenter.post(:file_created, path) # Write item FileUtils.mkdir_p(parent_path) File.open(path, 'w') do |io| - meta = attributes.stringify_keys_recursively + meta = attributes.__nanoc_stringify_keys_recursively unless meta == {} io.write(YAML.dump(meta).strip + "\n") io.write("---\n") end io.write(content) @@ -115,9 +117,9 @@ if filename =~ /(^|\/)index(\.[^\/]+)?$/ regex = @config && @config[:allow_periods_in_identifiers] ? /\/?(index)?(\.[^\/\.]+)?$/ : /\/?index(\.[^\/]+)?$/ else regex = @config && @config[:allow_periods_in_identifiers] ? /\.[^\/\.]+$/ : /\.[^\/]+$/ end - filename.sub(regex, '').cleaned_identifier + filename.sub(regex, '').__nanoc_cleaned_identifier end end end