express-hogan-pdf
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -34,3 +34,2 @@ 'use strict'; | ||
size: 12, | ||
trim: true, | ||
pre: false | ||
@@ -37,0 +36,0 @@ }, |
@@ -186,4 +186,4 @@ 'use strict'; | ||
let oldState = _.omit(state, ['doc', 'stack', 'parent']); | ||
oldState.style = _.extend({}, state.style), | ||
state.stack.push(oldState); | ||
state.style = _.clone(state.style); | ||
} | ||
@@ -242,3 +242,3 @@ | ||
state.path = 'pdf.page(' + (index + 1) + ')'; | ||
state.style = _.extend({}, this.config.styles.p); | ||
state.style = _.clone(this.config.styles.p); | ||
this.page(state, page.options, page.children); | ||
@@ -331,2 +331,3 @@ }); | ||
state.right = options.pos.right; | ||
state.doc.trim = true; | ||
} | ||
@@ -356,2 +357,3 @@ | ||
} | ||
state.doc.trim = true; | ||
@@ -454,3 +456,3 @@ } else { | ||
} | ||
state.link = options.href; | ||
state.style.link = options.href; | ||
@@ -525,12 +527,13 @@ this.genericTag(state, options, children); | ||
if (state.style.trim) { | ||
textContent = textContent.replace(/^\s+/mg, ''); | ||
} | ||
if (!state.style.pre) { | ||
textContent = textContent.replace(/[\n\s]+/g, ' '); | ||
} | ||
if (state.style.trim || state.doc.trim) { | ||
textContent = textContent.replace(/^\s+/mg, ''); | ||
state.doc.trim = false; | ||
} | ||
let options = _.clone(state.style); | ||
if (state.link) options.link = state.link; | ||
options.continued = true; | ||
options.link = options.link || false; | ||
@@ -543,3 +546,4 @@ debugText('Rendering text', | ||
y: state.doc.y, | ||
options: options | ||
options, | ||
stack: _.pluck(state.stack, 'style') | ||
} | ||
@@ -546,0 +550,0 @@ ); |
{ | ||
"name": "express-hogan-pdf", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "PDF generation using Hogan.js to template XML. Can be used as an express view engine or can output to a PDF stream, buffer, or file", | ||
@@ -5,0 +5,0 @@ "main": "lib/generate.js", |
@@ -376,4 +376,3 @@ 'use strict'; | ||
pre: false, | ||
size: 12, | ||
trim: true | ||
size: 12 | ||
}); | ||
@@ -397,4 +396,3 @@ }); | ||
pre: false, | ||
size: 12, | ||
trim: true | ||
size: 12 | ||
}); | ||
@@ -422,4 +420,3 @@ }); | ||
pre: false, | ||
size: 12, | ||
trim: true | ||
size: 12 | ||
}); | ||
@@ -426,0 +423,0 @@ }); |
Sorry, the diff of this file is not supported yet
69082