bin/mustache in mustache-0.5.0 vs bin/mustache in mustache-0.5.1

- old
+ new

@@ -4,12 +4,16 @@ require 'yaml' if STDIN.stat.size > 0 doc = STDIN.read if doc =~ /^(\s*---(.*)---\s*)/m - data = YAML.load($2.strip) - puts Mustache.render(doc.sub($1, ''), data) + yaml = $2.strip + template = doc.sub($1, '') + + YAML.each_document(yaml) do |data| + puts Mustache.render(template, data) + end else puts doc end else puts <<-usage @@ -28,7 +32,18 @@ --- names: [ {name: chris}, {name: mark}, {name: scott} ] --- The converted document will be printed on STDOUT. + +You can include multiple documents in your YAML frontmatter if you +like. Then the template is evaluated once for each of them. + + --- + name: chris + --- + name: mark + --- + name: scott + --- usage end