lib/nanoc/data_sources/filesystem.rb in nanoc-4.5.1 vs lib/nanoc/data_sources/filesystem.rb in nanoc-4.5.2
- old
+ new
@@ -300,13 +300,13 @@
return Nanoc::Identifier.new(filename)
end
regex =
if filename =~ /(^|\/)index(\.[^\/]+)?$/
- @config && @config[:allow_periods_in_identifiers] ? /\/?(index)?(\.[^\/\.]+)?$/ : /\/?index(\.[^\/]+)?$/
+ allow_periods_in_identifiers? ? /\/?(index)?(\.[^\/\.]+)?$/ : /\/?index(\.[^\/]+)?$/
else
- @config && @config[:allow_periods_in_identifiers] ? /\.[^\/\.]+$/ : /\.[^\/]+$/
+ allow_periods_in_identifiers? ? /\.[^\/\.]+$/ : /\.[^\/]+$/
end
Nanoc::Identifier.new(filename.sub(regex, ''), type: :legacy)
end
# Returns the base name of filename, i.e. filename with the first or all
@@ -327,13 +327,21 @@
# name. The first match group will be the entire extension, including the
# leading period.
#
# @return [Regex]
def extension_regex
- if @config && @config[:allow_periods_in_identifiers]
+ if allow_periods_in_identifiers?
/(\.[^\/\.]+$)/
else
/(\.[^\/]+$)/
+ end
+ end
+
+ def allow_periods_in_identifiers?
+ if @config
+ @config[:allow_periods_in_identifiers] || @config[:identifier_type] == 'full'
+ else
+ false
end
end
# @return [ParseResult]
def parse(content_filename, meta_filename)