DEV: Provide radix argument to parseInt (#8281)

* DEV: Provide radix 10 argument to parseInt

* DEV: Provide radix 16 argument to parseInt

* DEV: Remove unnecessary parseInt calls

* Fix year formatting

parseInt was used here to convert decimals to ints
This commit is contained in:
Jarek Radosz
2019-11-12 10:47:42 +01:00
committed by GitHub
parent 69266f60ed
commit 5d4b240453
44 changed files with 77 additions and 79 deletions

View File

@@ -145,22 +145,22 @@ function renderImage(tokens, idx, options, env, slf) {
// calculate using percentage
if (match[5] && match[6] && match[6] === "%") {
let percent = parseFloat(match[5]) / 100.0;
width = parseInt(width * percent);
height = parseInt(height * percent);
width = parseInt(width * percent, 10);
height = parseInt(height * percent, 10);
}
// calculate using only given width
if (match[5] && match[6] && match[6] === "x") {
let wr = parseFloat(match[5]) / width;
width = parseInt(match[5]);
height = parseInt(height * wr);
width = parseInt(match[5], 10);
height = parseInt(height * wr, 10);
}
// calculate using only given height
if (match[5] && match[4] && match[4] === "x" && !match[6]) {
let hr = parseFloat(match[5]) / height;
height = parseInt(match[5]);
width = parseInt(width * hr);
height = parseInt(match[5], 10);
width = parseInt(width * hr, 10);
}
if (token.attrIndex("width") === -1) {