File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ function main {
2727 # Build the Docker image, using Docker Hub as a cache. (This will be fast if nothing has changed
2828 # in html-build or its dependencies).
2929 docker pull whatwg/wattsi
30- docker pull ptspts/pdfsizeopt
3130 docker pull " $docker_hub_repo " || true
3231 docker build --cache-from " $docker_hub_repo " --tag " $docker_hub_repo " .
3332}
Original file line number Diff line number Diff line change @@ -14,6 +14,15 @@ echo "Running conformance checker..."
1414java -Xmx1g -jar ./vnu.jar --skip-non-html " $HTML_OUTPUT "
1515echo " "
1616
17+ # The build output contains some relative links, which will end up pointing to
18+ # "https://0.0.0.0:$PDF_SERVE_PORT/" in the built PDF. That's undesirable; see
19+ # https://github.com/whatwg/html/issues/9097. Our hack is to replace such
20+ # relative links like so. Note: we can't just insert a <base> or use Prince's
21+ # --baseurl option, because that would cause Prince to crawl the actual live
22+ # files for subresources, missing any updates to them we made as part of this
23+ # change.
24+ sed ' s| href=/| href=https://html.spec.whatwg.org/|g' " $HTML_OUTPUT /index.html" > " $HTML_OUTPUT /print.html"
25+
1726# Serve the built output so that Prince can snapshot it
1827# The nohup/sleep incantations are necessary because normal & does not work inside Docker:
1928# https://stackoverflow.com/q/50211207/3191
@@ -24,4 +33,6 @@ echo ""
2433
2534echo " "
2635echo " Building PDF..."
27- PATH=/whatwg/prince/bin:$PATH prince --verbose --output " $HTML_OUTPUT /print.pdf" " http://0.0.0.0:$PDF_SERVE_PORT /"
36+ PATH=/whatwg/prince/bin:$PATH prince --verbose --output " $HTML_OUTPUT /print.pdf" " http://0.0.0.0:$PDF_SERVE_PORT /print.html"
37+
38+ rm " $HTML_OUTPUT /print.html"
You can’t perform that action at this time.
0 commit comments