", htmlFile.indexOf("
+ ${fileEntry.filePath} |
+ ${String.format('%.1f', fileEntry.percentage)}% |
+
+
+
+ ${fileContent}
+ |
+
+ """
+ }.join('\n')
+
+ // Check if the package itself should be toggled
+ def toggleAction
+ if (packageFiles[packageName].size() == 1 || packageName.contains('.go')) {
+ toggleAction = "toggleFileContent(\"${packageFileMap[packageName][0].fileNumber}\")"
+ } else {
+ toggleAction = "toggleFiles(\"${packageName}\")"
+ }
+
+ return """
+
+ ${packageName} |
+ ${String.format('%.1f', averagePercentage)}% |
+
+ ${fileRows}
+ """
+ }.join('\n')
+ }
+
+ def packageCoverageRows = generatePackageCoverageRows(packagesWithoutGo) + generatePackageCoverageRows(packagesWithGo)
+
+ // Define the CSS classes
+ def cssStyles = """
+ .light-green {
+ background-color: #c8e6c9; /* light green */
+ }
+ .light-red {
+ background-color: #ffcdd2; /* light red */
+ }
+ .fileRow {
+ cursor: pointer;
+ }
+ .fileContentRow {
+ background-color: #f5f5f5;
+ }
+ #legend {
+ float: top;
+ margin-top: 15px;
+ }
+ #packageCoverageTable {
+ width: 100%;
+ }
+ .red {
+ color: red; /* red */
+ }
+ .green {
+ color: green; /* green */
+ }
+ """.stripIndent()
+
+ // Prepare the HTML content
+ def tableHtml = """
+
+
+
+
+ Package |
+ Coverage (%) |
+
+
+
+ ${packageCoverageRows}
+
+
+
+ """.stripIndent()
+
+ def scriptHtml = """
+
+ """.stripIndent()
+
+ // Remove the dropdown and insert the new table, script, and styles into the HTML file
+ def updatedHtmlFile = htmlFile.replaceAll(/(?s)