Browse Source

Post model getPost created, upated Readme.md

master
Sean Clarke 1 year ago
parent
commit
98f56a9761
  1. 5
      README.md
  2. 2
      index.js
  3. 8
      model/Post.js

5
README.md

@ -2,6 +2,11 @@
Build a blog using markdown files
## Rules!
md file structure has to follow these conditions:
* post specifics have to be tagged at the top of the page starting with '<--' and ending with '-->'. (Use the template)
* each post must then have a # heading.
## File Structure
To be continued

2
index.js

@ -33,4 +33,4 @@ var posts = new Listing();
posts = allPosts.forYearAndMonth(2018, 01);
console.log(posts);
console.log(posts.posts[0].getPost());

8
model/Post.js

@ -23,7 +23,7 @@ var Post = function(data){
Post.prototype.getDetails = function(){
// Patten to match the 'comment' section
var pattern = new RegExp(/^<--(.|\n)*-->/);
var pattern = new RegExp(/^<--(.|\n)*-->/); // set g later?
var options = fs.readFileSync(this.md, 'utf8').match(pattern)[0];
var details = [];
@ -39,4 +39,10 @@ Post.prototype.getDetails = function(){
return details;
};
Post.prototype.getPost = function(){
var pattern = new RegExp(/#(.|\n)*/);
var options = fs.readFileSync(this.md, 'utf8').match(pattern)[0];
return options;
}
module.exports = Post;
Loading…
Cancel
Save