/\A(---\r?\n(.*?)\n?^---\s*$\n?)/m
8 9 10 11 12 13 14
# File 'lib/yaml/front-matter.rb', line 8 def extract(content) if content =~ PATTERN return [YAML.load($2), content.sub($1, "")] else return [{}, content] end end