lib/nanoc/data_sources/filesystem.rb in nanoc-4.8.9 vs lib/nanoc/data_sources/filesystem.rb in nanoc-4.8.10

- old
+ new

@@ -369,18 +369,20 @@ meta_raw = read(meta_filename) meta = parse_metadata(meta_raw, meta_filename) ParseResult.new(content: content, attributes: meta, attributes_data: meta_raw) end + SEPARATOR = /(-{5}|-{3})/.source + # @return [ParseResult] def parse_with_frontmatter(content_filename) data = read(content_filename) - if data !~ /\A-{3,5}\s*$/ + if data !~ /\A#{SEPARATOR}\s*$/ return ParseResult.new(content: data, attributes: {}, attributes_data: '') end - pieces = data.split(/^(-{5}|-{3})[ \t]*\r?\n?/, 3) + pieces = data.split(/^#{SEPARATOR}[ \t]*\r?\n?/, 3) if pieces.size < 4 raise Errors::InvalidFormat.new(content_filename) end meta = parse_metadata(pieces[2], content_filename)