lib/nanoc/data_sources/filesystem_unified.rb in nanoc-3.6.4 vs lib/nanoc/data_sources/filesystem_unified.rb in nanoc-3.6.5

- old
+ new

@@ -34,11 +34,11 @@ # extensions; if it is false or unset, all extensions will be stripped. # For example: # # (`allow_periods_in_identifiers` set to true) # foo.entry.html → /foo.entry/ - # + # # (`allow_periods_in_identifiers` set to false) # foo.html.erb → /foo/ # # Note that each item must have an unique identifier. nanoc will display an # error if two items with the same identifier are found. @@ -106,11 +106,11 @@ end # Returns the identifier derived from the given filename, first stripping # the given directory name off the filename. def identifier_for_filename(filename) - if filename =~ /(^|\/)index\.[^\/]+$/ - regex = ((@config && @config[:allow_periods_in_identifiers]) ? /\/?index\.[^\/\.]+$/ : /\/?index\.[^\/]+$/) + 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 end