diff --git a/build.sh b/build.sh index adeb389..4bc3c8f 100755 --- a/build.sh +++ b/build.sh @@ -43,8 +43,27 @@ echo "Generating text output..." echo "Generating HTML output..." "$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 "Build complete:" echo " $DRAFT.xml (submit this to datatracker)" echo " $DRAFT.txt" echo " $DRAFT.html" +if [ "${PDF_OK:-0}" = "1" ]; then + echo " $DRAFT.pdf" +else + echo " (PDF generation skipped — missing deps)" +fi