Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 0e21fca

Browse files
cmarchandAirQuick
authored andcommitted
Enhance coverage-report.xsl to be able to specify css location (#194)
Also * Enhance it to be able to inline css * Update xspec.sh and xpsec.bat to enable inline css (aligned with #135)
1 parent b5707e9 commit 0e21fca

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

bin/xspec.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ if defined COVERAGE (
590590
-xsl:"%XSPEC_HOME%\src\reporter\coverage-report.xsl" ^
591591
tests="file:/%WIN_XSPEC_ABS:\\=/\\%" ^
592592
pwd="file:/%CD:\=/%/" ^
593+
inline-css=true ^
593594
|| ( call :die "Error formating the coverage report" & goto :win_main_error_exit )
594595
call :win_echo "Report available at %COVERAGE_HTML%"
595596
rem %OPEN% "%COVERAGE_HTML%"

bin/xspec.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ if test -n "$COVERAGE"; then
374374
-xsl:"$XSPEC_HOME/src/reporter/coverage-report.xsl" \
375375
"tests=$XSPEC" \
376376
"pwd=file:`pwd`/" \
377+
inline-css=true \
377378
|| die "Error formating the coverage report"
378379
echo "Report available at $COVERAGE_HTML"
379380
#$OPEN "$COVERAGE_HTML"

src/reporter/coverage-report.xsl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
<xsl:param name="pwd" as="xs:string" required="yes"/>
2323
<xsl:param name="tests" as="xs:string" required="yes"/>
2424

25+
<xsl:param name="inline-css">false</xsl:param>
26+
27+
<xsl:param name="report-css-uri" select="
28+
resolve-uri('test-report.css', static-base-uri())"/>
29+
30+
2531
<xsl:variable name="tests-uri" as="xs:anyURI" select="
2632
resolve-uri(translate($tests, '\', '/'), $pwd)"/>
2733

@@ -63,8 +69,15 @@
6369
<html>
6470
<head>
6571
<title>Test Coverage Report for <xsl:value-of select="test:format-URI($stylesheet-uri)" /></title>
66-
<link rel="stylesheet" type="text/css"
67-
href="{resolve-uri('test-report.css', static-base-uri())}" />
72+
<xsl:if test="$inline-css = 'false'">
73+
<link rel="stylesheet" type="text/css"
74+
href="{$report-css-uri}"/>
75+
</xsl:if>
76+
<xsl:if test="not($inline-css = 'false')">
77+
<style type="text/css">
78+
<xsl:value-of select="unparsed-text($report-css-uri)" disable-output-escaping="yes"/>
79+
</style>
80+
</xsl:if>
6881
</head>
6982
<body>
7083
<h1>Test Coverage Report</h1>

0 commit comments

Comments
 (0)