mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 12:17:20 +02:00
Windows compatibility fix (#583)
This commit is contained in:
parent
b220ec2f23
commit
cf59f72ecd
1 changed files with 2 additions and 2 deletions
|
@ -41,7 +41,7 @@ if (fs.existsSync(CWD + '/languages.js')) {
|
||||||
// included to prevent cyclical dependency with readMetadata.js
|
// included to prevent cyclical dependency with readMetadata.js
|
||||||
|
|
||||||
function splitHeader(content) {
|
function splitHeader(content) {
|
||||||
const lines = content.split('\n');
|
const lines = content.split(/\r?\n/);
|
||||||
let i = 1;
|
let i = 1;
|
||||||
for (; i < lines.length - 1; ++i) {
|
for (; i < lines.length - 1; ++i) {
|
||||||
if (lines[i] === '---') {
|
if (lines[i] === '---') {
|
||||||
|
@ -62,7 +62,7 @@ function extractMetadata(content) {
|
||||||
if (!both.content) {
|
if (!both.content) {
|
||||||
return {metadata, rawContent: both.header};
|
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) {
|
for (let i = 0; i < lines.length - 1; ++i) {
|
||||||
const keyvalue = lines[i].split(':');
|
const keyvalue = lines[i].split(':');
|
||||||
const key = keyvalue[0].trim();
|
const key = keyvalue[0].trim();
|
||||||
|
|
Loading…
Add table
Reference in a new issue