From 77abf1e865ff4ec53543a62028f70233b812806d Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 13 Nov 2024 22:18:14 +0100 Subject: [PATCH] fix: escape % --- dist/action.js | 6 +++--- dist/action.mjs | 6 +++--- dist/lib.js | 4 ++-- dist/lib.mjs | 4 ++-- src/action.ts | 2 +- src/lib.ts | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dist/action.js b/dist/action.js index 15e2ee4..5061fbe 100644 --- a/dist/action.js +++ b/dist/action.js @@ -19980,7 +19980,7 @@ function formatCoverage(coverage) { if (coverage > 0.8) color = "orange"; if (coverage > 0.95) color = "lightgreen"; if (coverage === 1) color = "green"; - return "{\\color{" + color + "}" + percent + "\\%}"; + return "{\\color{" + color + "}" + percent + "%}"; } var UP = `\u2191`; var DOWN = `\u2193`; @@ -19991,7 +19991,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) { if (diff) formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", { maximumSignificantDigits: 2 - }).format(diff) + "\\%" + formattedString; + }).format(diff) + "%" + formattedString; return `$${formattedString}$
$${hit} / ${found}$`; } function findFile(report, file) { @@ -20052,7 +20052,7 @@ async function main() { "report", `
:crystal_ball: Coverage report -${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$")} +${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$").replace(/\%/g, "\\%")}
` ); diff --git a/dist/action.mjs b/dist/action.mjs index e48acbc..be79b43 100644 --- a/dist/action.mjs +++ b/dist/action.mjs @@ -19985,7 +19985,7 @@ function formatCoverage(coverage) { if (coverage > 0.8) color = "orange"; if (coverage > 0.95) color = "lightgreen"; if (coverage === 1) color = "green"; - return "{\\color{" + color + "}" + percent + "\\%}"; + return "{\\color{" + color + "}" + percent + "%}"; } var UP = `\u2191`; var DOWN = `\u2193`; @@ -19996,7 +19996,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) { if (diff) formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", { maximumSignificantDigits: 2 - }).format(diff) + "\\%" + formattedString; + }).format(diff) + "%" + formattedString; return `$${formattedString}$
$${hit} / ${found}$`; } function findFile(report, file) { @@ -20057,7 +20057,7 @@ async function main() { "report", `
:crystal_ball: Coverage report -${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$")} +${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$").replace(/\%/g, "\\%")}
` ); diff --git a/dist/lib.js b/dist/lib.js index abab2ce..9308cea 100644 --- a/dist/lib.js +++ b/dist/lib.js @@ -31,7 +31,7 @@ function formatCoverage(coverage) { if (coverage > 0.8) color = "orange"; if (coverage > 0.95) color = "lightgreen"; if (coverage === 1) color = "green"; - return "{\\color{" + color + "}" + percent + "\\%}"; + return "{\\color{" + color + "}" + percent + "%}"; } var UP = `\u2191`; var DOWN = `\u2193`; @@ -42,7 +42,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) { if (diff) formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", { maximumSignificantDigits: 2 - }).format(diff) + "\\%" + formattedString; + }).format(diff) + "%" + formattedString; return `$${formattedString}$
$${hit} / ${found}$`; } function findFile(report, file) { diff --git a/dist/lib.mjs b/dist/lib.mjs index f5dca0f..989f574 100644 --- a/dist/lib.mjs +++ b/dist/lib.mjs @@ -7,7 +7,7 @@ function formatCoverage(coverage) { if (coverage > 0.8) color = "orange"; if (coverage > 0.95) color = "lightgreen"; if (coverage === 1) color = "green"; - return "{\\color{" + color + "}" + percent + "\\%}"; + return "{\\color{" + color + "}" + percent + "%}"; } var UP = `\u2191`; var DOWN = `\u2193`; @@ -18,7 +18,7 @@ function formatCoverageLine({ hit, found }, previousCoverage) { if (diff) formattedString = `^${diff > 0 ? UP : DOWN}` + new Intl.NumberFormat("en-US", { maximumSignificantDigits: 2 - }).format(diff) + "\\%" + formattedString; + }).format(diff) + "%" + formattedString; return `$${formattedString}$
$${hit} / ${found}$`; } function findFile(report, file) { diff --git a/src/action.ts b/src/action.ts index fd9acb8..e94d9ae 100644 --- a/src/action.ts +++ b/src/action.ts @@ -26,7 +26,7 @@ async function main() { setOutput( "report", - `
:crystal_ball: Coverage report\n\n${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$")}\n\n
`, + `
:crystal_ball: Coverage report\n\n${content.replace(/\\/g, "\\\\").replace(/\$/g, "\\$").replace(/\%/g, "\\%")}\n\n
`, ); } main(); diff --git a/src/lib.ts b/src/lib.ts index f5f8195..4e322d3 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -8,7 +8,7 @@ function formatCoverage(coverage: number) { if (coverage > 0.8) color = "orange"; if (coverage > 0.95) color = "lightgreen"; if (coverage === 1) color = "green"; - return "{\\color{" + color + "}" + percent + "\\%}"; + return "{\\color{" + color + "}" + percent + "%}"; } type GetCoverageLineParams = { @@ -35,7 +35,7 @@ function formatCoverageLine( new Intl.NumberFormat("en-US", { maximumSignificantDigits: 2, }).format(diff) + - "\\%" + + "%" + formattedString; return `$${formattedString}$
$${hit} / ${found}$`;