build: add PDF generation step (xml2rfc --pdf with weasyprint fallback)

This commit is contained in:
2026-04-12 14:01:21 +02:00
parent d47f041265
commit 3d01cb32b6

View File

@@ -43,8 +43,27 @@ echo "Generating text output..."
echo "Generating HTML output..." echo "Generating HTML output..."
"$XML2RFC" "$DIR/$DRAFT.xml" --html --quiet 2>/dev/null "$XML2RFC" "$DIR/$DRAFT.xml" --html --quiet 2>/dev/null
# Step 4: XML -> PDF (requires weasyprint + pangocffi + pycairo injected into xml2rfc venv
# and pydyf<0.10 pinned; see /home/c/projects/research.ietf/workspace/drafts/README-pdf.md)
echo "Generating PDF output..."
if "$XML2RFC" "$DIR/$DRAFT.xml" --pdf --quiet 2>/dev/null; then
PDF_OK=1
else
echo " xml2rfc --pdf failed; falling back to weasyprint on HTML"
if command -v weasyprint >/dev/null 2>&1; then
weasyprint "$DIR/$DRAFT.html" "$DIR/$DRAFT.pdf" >/dev/null 2>&1 && PDF_OK=1 || PDF_OK=0
else
PDF_OK=0
fi
fi
echo "" echo ""
echo "Build complete:" echo "Build complete:"
echo " $DRAFT.xml (submit this to datatracker)" echo " $DRAFT.xml (submit this to datatracker)"
echo " $DRAFT.txt" echo " $DRAFT.txt"
echo " $DRAFT.html" echo " $DRAFT.html"
if [ "${PDF_OK:-0}" = "1" ]; then
echo " $DRAFT.pdf"
else
echo " (PDF generation skipped — missing deps)"
fi