Windows compatibility fix (#583)

This commit is contained in:
Matthew Francis Brunetti 2018-05-05 22:29:28 -03:00 committed by Yangshun Tay
parent b220ec2f23
commit cf59f72ecd

View file

@ -41,7 +41,7 @@ if (fs.existsSync(CWD + '/languages.js')) {
// included to prevent cyclical dependency with readMetadata.js
function splitHeader(content) {
const lines = content.split('\n');
const lines = content.split(/\r?\n/);
let i = 1;
for (; i < lines.length - 1; ++i) {
if (lines[i] === '---') {
@ -62,7 +62,7 @@ function extractMetadata(content) {
if (!both.content) {
return {metadata, rawContent: both.header};
}
const lines = both.header.split('\n');
const lines = both.header.split(/\r?\n/);
for (let i = 0; i < lines.length - 1; ++i) {
const keyvalue = lines[i].split(':');
const key = keyvalue[0].trim();