Accept pandoc-style YAML frontmatter

Pandoc (and some other tools) have decided to end their YAML frontmatter
with `...` instead of `---`.  In the name of flexibility, this patch
allows either to mark the end of YAML frontmatter.

Example:

```
---
title: No place like home
...
```
This commit is contained in:
Christian Höltje 2014-08-14 22:15:17 -04:00
parent fae0e00f42
commit 6895f30ff3
3 changed files with 25 additions and 1 deletions

View file

@ -119,7 +119,7 @@ module Middleman::CoreExtensions
# @param [String] content
# @return [Array<Hash, String>]
def parse_yaml_front_matter(content, full_path)
yaml_regex = /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
yaml_regex = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
if content =~ yaml_regex
content = content.sub(yaml_regex, '')