lib/nanoc/data_sources/filesystem_unified.rb in nanoc-4.1.1 vs lib/nanoc/data_sources/filesystem_unified.rb in nanoc-4.1.2

- old
+ new

@@ -87,14 +87,15 @@ def identifier_for_filename(filename) if config[:identifier_type] == 'full' return Nanoc::Identifier.new(filename) end - if filename =~ /(^|\/)index(\.[^\/]+)?$/ - regex = @config && @config[:allow_periods_in_identifiers] ? /\/?(index)?(\.[^\/\.]+)?$/ : /\/?index(\.[^\/]+)?$/ - else - regex = @config && @config[:allow_periods_in_identifiers] ? /\.[^\/\.]+$/ : /\.[^\/]+$/ - end + regex = + if filename =~ /(^|\/)index(\.[^\/]+)?$/ + @config && @config[:allow_periods_in_identifiers] ? /\/?(index)?(\.[^\/\.]+)?$/ : /\/?index(\.[^\/]+)?$/ + else + @config && @config[:allow_periods_in_identifiers] ? /\.[^\/\.]+$/ : /\.[^\/]+$/ + end Nanoc::Identifier.new(filename.sub(regex, ''), type: :legacy) end end end