Fixed front matter empty lines

This commit is contained in:
benweet 2014-04-21 20:13:39 +01:00
parent d6acc601d3
commit 379ee55372

View File

@ -23,12 +23,13 @@ define([
return; return;
} }
var results = regex.exec(content); var results = regex.exec(content);
var frontMatter = results[1];
var yaml = results[2]; var yaml = results[2];
if(!yaml) { if(!yaml) {
fileDesc.frontMatter = undefined; fileDesc.frontMatter = undefined;
} }
else if(!fileDesc.frontMatter || fileDesc.frontMatter._yaml != yaml) { else if(!fileDesc.frontMatter || fileDesc.frontMatter._frontMatter != frontMatter) {
fileDesc.frontMatter = undefined; fileDesc.frontMatter = undefined;
try { try {
fileDesc.frontMatter = YAML.parse(yaml); fileDesc.frontMatter = YAML.parse(yaml);
@ -36,7 +37,7 @@ define([
fileDesc.frontMatter = undefined; fileDesc.frontMatter = undefined;
} }
fileDesc.frontMatter._yaml = yaml; fileDesc.frontMatter._yaml = yaml;
fileDesc.frontMatter._frontMatter = results[1]; fileDesc.frontMatter._frontMatter = frontMatter;
} }
catch (e) { catch (e) {
} }