@@ -10,13 +10,14 @@ DIR=$(pwd)
10
10
# The latest required version of Wattsi. Update this and the fallback in
11
11
# https://github.com/whatwg/wattsi/blob/master/src/build.sh if you change how ./build.sh invokes
12
12
# Wattsi.
13
- WATTSI_LATEST=90
13
+ WATTSI_LATEST=107
14
14
15
15
# Shared state variables throughout this script
16
16
LOCAL_WATTSI=true
17
17
DO_UPDATE=true
18
18
DO_LINT=true
19
19
DO_HIGHLIGHT=true
20
+ SINGLE_PAGE_ONLY=false
20
21
USE_DOCKER=false
21
22
VERBOSE=false
22
23
QUIET=false
@@ -134,6 +135,7 @@ function processCommandLineArgs {
134
135
echo " -n|--no-update Don't update before building; just build."
135
136
echo " -l|--no-lint Don't lint before building; just build."
136
137
echo " -h|--no-highlight Don't syntax-highlight the output."
138
+ echo " -p|--single-page Only build the single-page variant of the spec."
137
139
echo " -q|--quiet Don't emit any messages except errors/warnings."
138
140
echo " -v|--verbose Show verbose output from every build step."
139
141
exit 0
@@ -147,6 +149,9 @@ function processCommandLineArgs {
147
149
-h|--no-highlight)
148
150
DO_HIGHLIGHT=false
149
151
;;
152
+ -p|--single-page)
153
+ SINGLE_PAGE_ONLY=true
154
+ ;;
150
155
-d|--docker)
151
156
USE_DOCKER=true
152
157
;;
@@ -427,7 +432,7 @@ function relativePath {
427
432
# Arguments: none
428
433
# Output: A web server with the build output will be running inside the Docker container
429
434
function doDockerBuild {
430
- DOCKER_BUILD_ARGS=( --tag whatwg-html )
435
+ DOCKER_BUILD_ARGS=( --tag whatwg-html --build-arg " WATTSI_VERSION= $WATTSI_LATEST " )
431
436
$QUIET && DOCKER_BUILD_ARGS+=( --quiet )
432
437
433
438
docker build " ${DOCKER_BUILD_ARGS[@]} " .
@@ -440,6 +445,7 @@ function doDockerBuild {
440
445
$DO_UPDATE || DOCKER_RUN_ARGS+=( --no-update )
441
446
$DO_LINT || DOCKER_RUN_ARGS+=( --no-lint )
442
447
$DO_HIGHLIGHT || DOCKER_RUN_ARGS+=( --no-highlight )
448
+ $SINGLE_PAGE_ONLY && DOCKER_RUN_ARGS+=( --single-page )
443
449
$SERVE && DOCKER_RUN_ARGS+=( --serve )
444
450
445
451
# Pass in the html-build SHA (since there's no .git directory inside the container)
@@ -555,17 +561,22 @@ function processSource {
555
561
# Singlepage HTML
556
562
mv " $HTML_TEMP /wattsi-output/index-html" " $HTML_OUTPUT /index.html"
557
563
558
- # Singlepage Commit Snapshot
559
- COMMIT_DIR=" $HTML_OUTPUT /commit-snapshots/$HTML_SHA "
560
- mkdir -p " $COMMIT_DIR "
561
- mv " $HTML_TEMP /wattsi-output/index-snap" " $COMMIT_DIR /index.html"
564
+ if [[ $SINGLE_PAGE_ONLY == " false" ]]; then
565
+ # Singlepage Commit Snapshot
566
+ COMMIT_DIR=" $HTML_OUTPUT /commit-snapshots/$HTML_SHA "
567
+ mkdir -p " $COMMIT_DIR "
568
+ mv " $HTML_TEMP /wattsi-output/index-snap" " $COMMIT_DIR /index.html"
569
+
570
+ # Multipage HTML and Dev Edition
571
+ mv " $HTML_TEMP /wattsi-output/multipage-html" " $HTML_OUTPUT /multipage"
572
+ mv " $HTML_TEMP /wattsi-output/multipage-dev" " $HTML_OUTPUT /dev"
573
+
574
+ cp -pR " $HTML_SOURCE /dev" " $HTML_OUTPUT "
575
+ fi
562
576
563
577
cp -p entities/out/entities.json " $HTML_OUTPUT "
564
578
cp -p " $HTML_TEMP /wattsi-output/xrefs.json" " $HTML_OUTPUT "
565
579
566
- # Multipage HTML and Dev Edition
567
- mv " $HTML_TEMP /wattsi-output/multipage-html" " $HTML_OUTPUT /multipage"
568
- mv " $HTML_TEMP /wattsi-output/multipage-dev" " $HTML_OUTPUT /dev"
569
580
clearDir " $HTML_TEMP "
570
581
571
582
echo " User-agent: *
@@ -578,7 +589,6 @@ Disallow: /review-drafts/" > "$HTML_OUTPUT/robots.txt"
578
589
cp -pR " $HTML_SOURCE /fonts" " $HTML_OUTPUT "
579
590
cp -pR " $HTML_SOURCE /images" " $HTML_OUTPUT "
580
591
cp -pR " $HTML_SOURCE /demos" " $HTML_OUTPUT "
581
- cp -pR " $HTML_SOURCE /dev" " $HTML_OUTPUT "
582
592
else
583
593
# Singlepage Review Draft
584
594
YEARMONTH=$( basename " $SOURCE_LOCATION " .wattsi)
@@ -621,9 +631,12 @@ function runWattsi {
621
631
622
632
if [[ " $LOCAL_WATTSI " == " true" ]]; then
623
633
WATTSI_ARGS=()
624
- if $QUIET ; then
634
+ if [[ " $QUIET " == " true " ]] ; then
625
635
WATTSI_ARGS+=( --quiet )
626
636
fi
637
+ if [[ " $SINGLE_PAGE_ONLY " == " true" ]]; then
638
+ WATTSI_ARGS+=( --single-page-only )
639
+ fi
627
640
WATTSI_ARGS+=( " $1 " " $HTML_SHA " " $2 " " $BUILD_TYPE " \
628
641
" $HTML_CACHE /caniuse.json" \
629
642
" $HTML_CACHE /mdn-spec-links-html.json" )
@@ -637,17 +650,26 @@ function runWattsi {
637
650
$QUIET || echo
638
651
$QUIET || echo " Local wattsi or pip3 are not present; trying the build server..."
639
652
640
- CURL_ARGS=( https://build.whatwg.org/wattsi \
653
+ CURL_URL=" https://build.whatwg.org/wattsi"
654
+ if [[ " $QUIET " == " true" && " $SINGLE_PAGE_ONLY " == " true" ]]; then
655
+ CURL_URL=" $CURL_URL ?quiet&single-page-only"
656
+ elif [[ " $QUIET " == " true" ]]; then
657
+ CURL_URL=" $CURL_URL ?quiet"
658
+ elif [[ " $SINGLE_PAGE_ONLY " == " true" ]]; then
659
+ CURL_URL=" $CURL_URL ?single-page-only"
660
+ fi
661
+
662
+ CURL_ARGS=( " $CURL_URL " \
641
663
--form " source=@$1 " \
642
664
--form " sha=$HTML_SHA " \
643
665
--form " build=$BUILD_TYPE " \
644
666
--form " caniuse=@$HTML_CACHE /caniuse.json" \
645
667
--form " mdn=@$HTML_CACHE /mdn-spec-links-html.json" \
646
668
--dump-header " $HTML_TEMP /wattsi-headers.txt" \
647
669
--output " $HTML_TEMP /wattsi-output.zip" )
648
- if $VERBOSE ; then
670
+ if [[ " $VERBOSE " == " true " ]] ; then
649
671
CURL_ARGS+=( --verbose )
650
- elif $QUIET ; then
672
+ elif [[ " $QUIET " == " true " ]] ; then
651
673
CURL_ARGS+=( --silent )
652
674
fi
653
675
curl " ${CURL_ARGS[@]} "
0 commit comments