1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 18:56:22 +00:00

fix bad conditions

This commit is contained in:
Baptiste Augrain
2018-11-15 23:52:42 +01:00
parent c796b3b30e
commit 9e770ef357

View File

@@ -70,7 +70,7 @@ function getFrontMatter (markdown) {
if (delimiterRegExp.test(lines[0])) {
let line = 0
while (++line < lines.length && delimiterRegExp.test(lines[line])) {
while (++line < lines.length && !delimiterRegExp.test(lines[line])) {
}
return yaml.load(lines.slice(1, line).join('\n')) || {}
@@ -82,9 +82,9 @@ function getFrontMatter (markdown) {
function replaceFrontMatter (markdown, metadata) {
const lines = markdown.split('\n')
if (lines[0] === '---') {
if (delimiterRegExp.test(lines[0])) {
let line = 0
while (++line < lines.length && lines[line] !== '---') {
while (++line < lines.length && !delimiterRegExp.test(lines[line])) {
}
return `---\n${yaml.dump(metadata)}---\n${lines.slice(line + 1).join('\n')}`