Skip to content

Commit b44d96e

Browse files
author
Tiago Vasconcelos
committed
bug fixing
1 parent 84f1d3d commit b44d96e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/crawler/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const fs = require('fs');
22
const { join, sep } = require('path');
33

44
function getDetails(data) {
5-
const matadata = data.match(/---(.*\n)*---/)[0];
5+
const matadata = data.match(/---(.*(\r)?\n)*---/g)[0];
66
const details = matadata.match(/(.*):(.*)/g).reduce((obj, detail) => {
77
const value = detail.substr(detail.indexOf(':') + 2);
88
const key = detail.substr(0, detail.indexOf(':'));
@@ -13,7 +13,7 @@ function getDetails(data) {
1313
}
1414

1515
function getPreview(data) {
16-
let preview = data.replace(/---(.*\n)*---/, '').replace(/\[.*\]\(.*\)/g, '').replace(/\n/,'');
16+
let preview = data.replace(/---(.*(\r)?\n)*---/, '').replace(/\[.*\]\(.*\)/g, '').replace(/(\r)?\n/,'');
1717
preview = preview.substr(0, (preview.indexOf('\n') -1));
1818
return preview.length < 500? preview : preview.substr(0, 500);
1919
}
@@ -26,6 +26,7 @@ function getFolders(source) {
2626
let allContent = getAllListings(source);
2727
const edges = allContent.filter(isFile).map(file => {
2828
const data = fs.readFileSync(file, 'utf-8');
29+
// console.log('get folders', JSON.stringify(data))
2930
return {
3031
id: file.substr(file.lastIndexOf(sep) + 1),
3132
path: file,
@@ -52,4 +53,4 @@ function generateFileList(src) {
5253

5354
module.exports = {
5455
generateFileList
55-
};
56+
};

src/routes/blog/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function getBlogBody(data, isLoading) {
3535
{ details.subtitle && <caption class={style.blogsubtitle}>{details.subtitle}</caption> }
3636
{ details.cover && <div class={style.blogcover} style={`background-image:url(${details.cover})`} /> }
3737
<div class={style.blogbody}>
38-
<Markdown>{ content }</Markdown>
38+
<Markdown>{ content.split(/---(.*(\r)?\n)*---/g)[3] /*hack for getting just content*/ }</Markdown>
3939
</div>
4040
</div>
4141
);

0 commit comments

Comments
 (0)