Comparing version 0.6.3 to 0.6.8
@@ -11,3 +11,3 @@ "use strict"; | ||
this.provider = {}; | ||
this.render = ["html", "json"]; | ||
this.render = ["html", "json", "atom"]; | ||
this.output = "./blog_output"; | ||
@@ -14,0 +14,0 @@ this.template = "basic_html"; |
@@ -52,3 +52,9 @@ "use strict"; | ||
let html = cheerio.load(body); | ||
this.metaData.summary = "<p>" + html("p").html() + "</p>"; | ||
let summaryLength = 3; | ||
this.metaData.summary = ""; | ||
html("p").each((i, elem) => { | ||
if (i < summaryLength) { | ||
this.metaData.summary = this.metaData.summary + html.html(elem); | ||
} | ||
}); | ||
} | ||
@@ -55,0 +61,0 @@ return this.metaData.summary; |
@@ -12,3 +12,3 @@ import { DataService } from "../data/dataService"; | ||
renderTag(tag: Tag, tags: Array<Tag>, config: Config): Promise<string>; | ||
renderPost(post: Post, tags: Array<Tag>, config: Config): Promise<string>; | ||
renderPost(post: Post, previousPost: Post, nextPost: Post, tags: Array<Tag>, config: Config): Promise<string>; | ||
renderTemplate(source: string, data: any, config: Config): string; | ||
@@ -15,0 +15,0 @@ getPostTemplate(config: Config): string; |
@@ -17,4 +17,18 @@ "use strict"; | ||
//posts | ||
posts.forEach(async (post) => { | ||
let postHtml = await this.renderPost(post, tags, config); | ||
let previousPost; | ||
let nextPost; | ||
posts.forEach(async (post, index) => { | ||
if (index === 0) { | ||
previousPost = posts[posts.length - 1]; | ||
} | ||
else { | ||
previousPost = posts[index - 1]; | ||
} | ||
if (index === posts.length - 1) { | ||
nextPost = posts[0]; | ||
} | ||
else { | ||
nextPost = posts[index + 1]; | ||
} | ||
let postHtml = await this.renderPost(post, previousPost, nextPost, tags, config); | ||
let postPath = output + "/" + post.id; | ||
@@ -53,7 +67,7 @@ fs.ensureDirSync(postPath); | ||
} | ||
async renderPost(post, tags, config) { | ||
async renderPost(post, previousPost, nextPost, tags, config) { | ||
let result = ""; | ||
if (post) { | ||
let source = this.getPostTemplate(config); | ||
result = this.renderTemplate(source, { post: post, tags: tags }, config); | ||
result = this.renderTemplate(source, { post: post, previousPost: previousPost, nextPost: nextPost, tags: tags }, config); | ||
} | ||
@@ -60,0 +74,0 @@ return result; |
{ | ||
"name": "writr", | ||
"version": "0.6.3", | ||
"version": "0.6.8", | ||
"description": "A Simple to Use Markdown Blog", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index", |
@@ -9,2 +9,3 @@ ![Writr](logo.png) | ||
[![codecov](https://codecov.io/gh/jaredwray/writr/branch/master/graph/badge.svg)](https://codecov.io/gh/jaredwray/writr) | ||
[![npm](https://img.shields.io/npm/dw/writr)](https://npmjs.com/packages/writr) | ||
@@ -11,0 +12,0 @@ --- |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65881
990
60