Skip to content

Commit

Permalink
Merge branch 'release/v1.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
joeworkman committed Aug 24, 2021
2 parents 18891d3 + e0f2686 commit fa348e5
Show file tree
Hide file tree
Showing 3 changed files with 426 additions and 544 deletions.
6 changes: 3 additions & 3 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ function render(file, enc, cb) {

// Finally, add the page as a partial called "body", and render the layout template
this.Handlebars.registerPartial('body', pageTemplate);
file.contents = new Buffer(layoutTemplate(pageData));
file.contents = new Buffer.from(layoutTemplate(pageData));
}
catch (e) {
if (layoutTemplate) {
// Layout was parsed properly so we can insert the error message into the body of the layout
this.Handlebars.registerPartial('body', 'Panini: template could not be parsed <br> \n <pre>{{error}}</pre>');
file.contents = new Buffer(layoutTemplate({ error: e }));
file.contents = new Buffer.from(layoutTemplate({ error: e }));
}
else {
// Not even once - write error directly into the HTML output so the user gets an error
// Maintain basic html structure to allow Livereloading scripts to be injected properly
file.contents = new Buffer('<!DOCTYPE html><html><head><title>Panini error</title></head><body><pre>'+e+'</pre></body></html>');
file.contents = new Buffer.from('<!DOCTYPE html><html><head><title>Panini error</title></head><body><pre>'+e+'</pre></body></html>');
}

throw new Error('Panini: rendering error occured.\n' + e);
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "panini",
"version": "1.7.1",
"version": "1.7.2",
"description": "A super tiny flat file compiler.",
"main": "index.js",
"scripts": {
Expand All @@ -18,7 +18,7 @@
"handlebars": "^4.0.5",
"highlight.js": "^8.9.1",
"js-yaml": "^3.14.0",
"marked": "^1.1.1",
"marked": "^2",
"nopt": "^4.0.1",
"slash": "^1.0.0",
"strip-bom": "2.0.0",
Expand All @@ -35,6 +35,10 @@
"mocha": "^8.0.1",
"mocha-lcov-reporter": "^1.3.0"
},
"resolutions": {
"glob-parent": "^5.1.2",
"yargs-parser": "^20.2.4"
},
"repository": {
"type": "git",
"url": "https://github.com/foundation/panini"
Expand Down
Loading

0 comments on commit fa348e5

Please sign in to comment.