Skip to content

Commit

Permalink
v2.2.6
Browse files Browse the repository at this point in the history
remove duplicate "decoration" values (see issue #108)
  • Loading branch information
Aymkdn committed Jun 24, 2021
1 parent e553a2d commit 400722d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion browser.js

Large diffs are not rendered by default.

Binary file modified example.pdf
Binary file not shown.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ function htmlToPdfMake(htmlText, options) {
});
// styles
var style;
// not all the CSS properties should be inhirent
// not all the CSS properties should be inherent
var ignoreNonDescendentProperties = (parentIndex!==lastIndex);
// 1) the default styles
if (_this.defaultStyles[parentNodeName]) {
Expand All @@ -517,7 +517,10 @@ function htmlToPdfMake(htmlText, options) {
// 'decoration' can be an array
if (style === 'decoration') {
if (!Array.isArray(params.ret[style])) params.ret[style]=[];
params.ret[style].push(_this.defaultStyles[parentNodeName][style]);
// do not apply twice the same (e.g. applying 2 "underline" will cause an extra blank space with an underline)
if (params.ret[style].indexOf(_this.defaultStyles[parentNodeName][style]) === -1) {
params.ret[style].push(_this.defaultStyles[parentNodeName][style]);
}
} else {
params.ret[style] = _this.defaultStyles[parentNodeName][style];
}
Expand All @@ -526,7 +529,7 @@ function htmlToPdfMake(htmlText, options) {
}
}
// 2) element's style
// we want TD/TH to receive descendent properties from TR
// we want TD/TH to receive descendant properties from TR
if (parentNodeName === 'tr') ignoreNonDescendentProperties=false;
style = _this.parseStyle(parent, ignoreNonDescendentProperties);
style.forEach(function(stl) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-to-pdfmake",
"version": "2.2.5",
"version": "2.2.6",
"description": "Convert HTML code to PDFMake",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 400722d

Please sign in to comment.