#!/bin/sh # Render the XPath coverage markdown report to PDF using pandoc + weasyprint. # # Prepends an HTML cover page and replaces the emoji status markers with # CSS-styled spans, then hands the result to pandoc. Runs inside the # infix-test container, where pandoc, weasyprint and the fonts live. # # Usage: # render_coverage_pdf.sh set -e md="$1" css="$2" logo="$3" ver="$4" pdf="$5" gen=$(sed -n 's/^Generated: //p' "$md" | head -1 | cut -d' ' -f1) { printf '
\n' printf '\n' "$logo" printf '

XPath Coverage Report

\n' printf '

%s

\n' "$ver" printf '

%s

\n' "$gen" printf '
\n\n' sed -e 's,🟢,,g' \ -e 's,🟠,,g' \ -e 's,🔴,,g' \ -e 's,✅,,g' \ -e 's,❌,,g' \ -e '/^# XPath Coverage Report$/d' \ -e '/^Generated: /d' \ "$md" } > "$md.pdf.md" pandoc "$md.pdf.md" \ -f gfm \ --pdf-engine=weasyprint \ -c "$css" \ -o "$pdf" rm -f "$md.pdf.md"