Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

writr

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

writr - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

4

dist/render/htmlProvider.d.ts

@@ -12,4 +12,4 @@ import { DataService } from "../data/dataService";

renderTag(tag: Tag, config: Config): Promise<string>;
renderPost(post: Post, config: Config): Promise<string>;
renderTemplate(source: string, data: object): string;
renderPost(post: Post, tags: Array<Tag>, config: Config): Promise<string>;
renderTemplate(source: string, data: any, config: Config): string;
getPostTemplate(config: Config): string;

@@ -16,0 +16,0 @@ getTagTemplate(config: Config): string;

@@ -19,6 +19,7 @@ "use strict";

fs.writeFileSync(output + "/index.html", await this.renderHome(dataStore, config));
let posts = await dataStore.getPosts();
let tags = await dataStore.getTags();
//posts
let posts = await dataStore.getPosts();
posts.forEach(async (post) => {
let postHtml = await this.renderPost(post, config);
let postHtml = await this.renderPost(post, tags, config);
let postPath = output + "/" + post.id;

@@ -30,3 +31,2 @@ fs.ensureDirSync(postPath);

fs.ensureDirSync(output + "/tags/");
let tags = await dataStore.getTags();
tags.forEach(async (tag) => {

@@ -46,3 +46,3 @@ let tagHtml = await this.renderTag(tag, config);

let source = this.getHomeTemplate(config);
result = this.renderTemplate(source, { tags: tagList, posts: postList });
result = this.renderTemplate(source, { tags: tagList, posts: postList }, config);
return result;

@@ -54,18 +54,26 @@ }

let source = this.getTagTemplate(config);
result = this.renderTemplate(source, tag);
result = this.renderTemplate(source, tag, config);
}
return result;
}
async renderPost(post, config) {
async renderPost(post, tags, config) {
let result = "";
if (post) {
let source = this.getPostTemplate(config);
//fix to handle the body variable from markdown.
//source = source.replace("{{body}}", post.body);
result = this.renderTemplate(source, post);
result = this.renderTemplate(source, { post: post, tags: tags }, config);
}
return result;
}
renderTemplate(source, data) {
renderTemplate(source, data, config) {
let result = "";
let date = new Date();
data.writr = config;
data.today = {
time: date.getTime(),
month: date.getMonth(),
day: date.getDay(),
date: date.getDate(),
year: date.getFullYear(),
timezone: date.getTimezoneOffset()
};
let template = handlebars.compile(source);

@@ -72,0 +80,0 @@ result = template(data);

{
"name": "writr",
"version": "0.5.1",
"version": "0.5.2",
"description": "A Simple to Use Markdown Blog",

@@ -5,0 +5,0 @@ "main": "./dist/index",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc