@@ -16,6 +16,7 @@ WATTSI_LATEST=90
16
16
LOCAL_WATTSI=true
17
17
DO_UPDATE=true
18
18
DO_LINT=true
19
+ DO_HIGHLIGHT=true
19
20
USE_DOCKER=false
20
21
VERBOSE=false
21
22
QUIET=false
@@ -128,12 +129,13 @@ function processCommandLineArgs {
128
129
echo " $0 help Show this usage statement."
129
130
echo
130
131
echo " Build options:"
131
- echo " -d|--docker Use Docker to build in a container."
132
- echo " -s|--serve After building, serve the results on http://localhost:$SERVE_PORT ."
133
- echo " -n|--no-update Don't update before building; just build."
134
- echo " -l|--no-lint Don't lint before building; just build."
135
- echo " -q|--quiet Don't emit any messages except errors/warnings."
136
- echo " -v|--verbose Show verbose output from every build step."
132
+ echo " -d|--docker Use Docker to build in a container."
133
+ echo " -s|--serve After building, serve the results on http://localhost:$SERVE_PORT ."
134
+ echo " -n|--no-update Don't update before building; just build."
135
+ echo " -l|--no-lint Don't lint before building; just build."
136
+ echo " -h|--no-highlight Don't syntax-highlight the output."
137
+ echo " -q|--quiet Don't emit any messages except errors/warnings."
138
+ echo " -v|--verbose Show verbose output from every build step."
137
139
exit 0
138
140
;;
139
141
-n|--no-update|--no-updates)
@@ -142,6 +144,9 @@ function processCommandLineArgs {
142
144
-l|--no-lint)
143
145
DO_LINT=false
144
146
;;
147
+ -h|--no-highlight)
148
+ DO_HIGHLIGHT=false
149
+ ;;
145
150
-d|--docker)
146
151
USE_DOCKER=true
147
152
;;
@@ -196,16 +201,20 @@ function checkHTMLBuildIsUpToDate {
196
201
# Tries to install the bs-highlighter Python package if necessary
197
202
# - Arguments: none
198
203
# - Output:
199
- # - Either bs-highlighter-server will be in the $PATH, or a warning will be echoed
204
+ # - Either bs-highlighter-server will be in the $PATH, or $DO_HIGHTLIGHT will be set to false and
205
+ # a warning will be echoed.
200
206
function ensureHighlighterInstalled {
201
207
# If we're not using local Wattsi then we won't use the local highlighter.
202
- if [[ $LOCAL_WATTSI == " true" ]]; then
208
+ if [[ $LOCAL_WATTSI == " true" && $DO_HIGHLIGHT == " true " ]]; then
203
209
if hash pip3 2> /dev/null; then
204
210
if ! hash bs-highlighter-server 2> /dev/null; then
205
211
pip3 install bs-highlighter
206
212
fi
207
213
else
208
- LOCAL_WATTSI=" false"
214
+ echo
215
+ echo " Warning: could not find pip3 in your PATH. Disabling syntax highlighting."
216
+ echo
217
+ DO_HIGHLIGHT=" false"
209
218
fi
210
219
fi
211
220
}
@@ -430,6 +439,7 @@ function doDockerBuild {
430
439
$VERBOSE && DOCKER_RUN_ARGS+=( --verbose )
431
440
$DO_UPDATE || DOCKER_RUN_ARGS+=( --no-update )
432
441
$DO_LINT || DOCKER_RUN_ARGS+=( --no-lint )
442
+ $DO_HIGHLIGHT || DOCKER_RUN_ARGS+=( --no-highlight )
433
443
$SERVE && DOCKER_RUN_ARGS+=( --serve )
434
444
435
445
# Pass in the html-build SHA (since there's no .git directory inside the container)
@@ -609,15 +619,18 @@ function checkWattsi {
609
619
function runWattsi {
610
620
clearDir " $2 "
611
621
612
- WATTSI_ARGS=()
613
- if $QUIET ; then
614
- WATTSI_ARGS+=( --quiet )
615
- fi
616
- WATTSI_ARGS+=( " $1 " " $HTML_SHA " " $2 " " $BUILD_TYPE " \
617
- " $HTML_CACHE /caniuse.json" \
618
- " $HTML_CACHE /mdn-spec-links-html.json" \
619
- " $HIGHLIGHT_SERVER_URL " )
620
622
if [[ " $LOCAL_WATTSI " == " true" ]]; then
623
+ WATTSI_ARGS=()
624
+ if $QUIET ; then
625
+ WATTSI_ARGS+=( --quiet )
626
+ fi
627
+ WATTSI_ARGS+=( " $1 " " $HTML_SHA " " $2 " " $BUILD_TYPE " \
628
+ " $HTML_CACHE /caniuse.json" \
629
+ " $HTML_CACHE /mdn-spec-links-html.json" )
630
+ if [[ " $DO_HIGHLIGHT " == " true" ]]; then
631
+ WATTSI_ARGS+=( " $HIGHLIGHT_SERVER_URL " )
632
+ fi
633
+
621
634
WATTSI_RESULT=" 0"
622
635
wattsi " ${WATTSI_ARGS[@]} " || WATTSI_RESULT=$?
623
636
else
@@ -681,7 +694,7 @@ function generateBacklinks {
681
694
# - A server will be running in the background, at $HIGHLIGHT_SERVER_URL
682
695
# - $HIGHLIGHT_SERVER_PID will be set for later use by stopHighlightServer
683
696
function startHighlightServer {
684
- if [[ " $LOCAL_WATTSI " == " true" ]]; then
697
+ if [[ " $LOCAL_WATTSI " == " true" && " $DO_HIGHLIGHT " == " true " ]]; then
685
698
HIGHLIGHT_SERVER_ARGS=()
686
699
$QUIET && HIGHLIGHT_SERVER_ARGS+=( --quiet )
687
700
bs-highlighter-server ${HIGHLIGHT_SERVER_ARGS[@]+" ${HIGHLIGHT_SERVER_ARGS[@]} " } &
0 commit comments