@@ -168,33 +168,61 @@ perl .pre-process-annotate-attributes.pl < $HTML_TEMP/source-expanded-1 > $HTML_
168
168
perl .pre-process-tag-omission.pl < $HTML_TEMP /source-expanded-2 > $HTML_TEMP /source-whatwg-complete # this one could be merged
169
169
mkdir $HTML_TEMP /wattsi-output
170
170
171
- if hash wattsi 2> /dev/null; then
172
- # XXX wattsi --quiet awaits review https://github.com/whatwg/wattsi/pull/2
173
- # In the mean time, wattsi --quiet will fail with "invalid arguments"
174
- # unless you build from the wattsi pr/2 branch.
175
- wattsi $( $QUIET && echo " --quiet" ) \
176
- $HTML_TEMP /source-whatwg-complete $HTML_TEMP /wattsi-output \
177
- $HTML_CACHE /caniuse.json $HTML_CACHE /w3cbugs.csv
178
- else
179
- $QUIET || echo
180
- $QUIET || echo " Local wattsi is not present; trying the build server..."
181
-
182
- HTTP_CODE=` curl $( $VERBOSE && echo " -v" ) $( $QUIET && echo " -s" ) \
183
- http://ec2-52-88-42-163.us-west-2.compute.amazonaws.com/ \
184
- --write-out " %{http_code}" \
185
- --form source=@$HTML_TEMP /source-whatwg-complete \
186
- --form caniuse=@$HTML_CACHE /caniuse.json \
187
- --form w3cbugs=@$HTML_CACHE /w3cbugs.csv \
188
- --output $HTML_TEMP /wattsi-output.zip`
189
-
190
- if [ " $HTTP_CODE " != " 200" ]; then
191
- cat $HTML_TEMP /wattsi-output.zip
192
- rm -f $HTML_TEMP /wattsi-output.zip
193
- exit 22
171
+ function runWattsi {
172
+ # Input argument: $1 is the file to run wattsi on
173
+ # Output:
174
+ # - Sets global variable $WATTSI_RESULT to an exit code (or equivalent, for HTTP version)
175
+ # - $HTML_TEMP/wattsi-output directory will contain the output from wattsi on success
176
+ # - $HTML_TEMP/wattsi-output.txt will contain the output from wattsi, on both success and failure
177
+
178
+ rm -rf $HTML_TEMP /wattsi-output
179
+ mkdir $HTML_TEMP /wattsi-output
180
+
181
+ if hash wattsi 2> /dev/null; then
182
+ WATTSI_RESULT=$( wattsi $( $QUIET && echo " --quiet" ) $1 $HTML_TEMP /wattsi-output \
183
+ $HTML_CACHE /caniuse.json $HTML_CACHE /w3cbugs.csv \
184
+ > $HTML_TEMP /wattsi-output.txt; echo $? )
185
+ else
186
+ $QUIET || echo
187
+ $QUIET || echo " Local wattsi is not present; trying the build server..."
188
+
189
+ HTTP_CODE=` curl $( $VERBOSE && echo " -v" ) $( $QUIET && echo " -s" ) \
190
+ http://ec2-52-88-42-163.us-west-2.compute.amazonaws.com/ \
191
+ --write-out " %{http_code}" \
192
+ --form source=@$1 \
193
+ --form caniuse=@$HTML_CACHE /caniuse.json \
194
+ --form w3cbugs=@$HTML_CACHE /w3cbugs.csv \
195
+ --output $HTML_TEMP /wattsi-output.zip`
196
+
197
+ if [ " $HTTP_CODE " != " 200" ]; then
198
+ mv $HTML_TEMP /wattsi-output.zip $HTML_TEMP /wattsi-output.txt
199
+ WATTSI_RESULT=1
200
+ else
201
+ unzip $( $VERBOSE && echo " -v" || echo " -qq" ) $HTML_TEMP /wattsi-output.zip -d $HTML_TEMP /wattsi-output
202
+ mv $HTML_TEMP /wattsi-output/output.txt $HTML_TEMP /wattsi-output.txt
203
+ WATTSI_RESULT=0
204
+ fi
205
+ fi
206
+ }
207
+
208
+ runWattsi $HTML_TEMP /source-whatwg-complete
209
+
210
+ if [[ " $WATTSI_RESULT " -ne " 0" ]]; then
211
+ mv $HTML_TEMP /wattsi-output.txt $HTML_TEMP /wattsi-first-pass-output.txt
212
+ runWattsi $HTML_SOURCE /source
213
+
214
+ cat $HTML_TEMP /wattsi-first-pass-output.txt | grep -v ' ^$' # trim blank lines
215
+
216
+ if [[ " $WATTSI_RESULT " -ne " 0" ]]; then
217
+ echo
218
+ echo " The correct line numbers for errors in the $HTML_SOURCE /source file are shown below:"
219
+ echo
220
+ cat $HTML_TEMP /wattsi-output.txt | grep -v ' ^$' # trim blank lines
194
221
fi
195
222
196
- unzip $( $VERBOSE && echo " -v" || echo " -qq" ) $HTML_TEMP /wattsi-output.zip -d $HTML_TEMP /wattsi-output
197
- cat $HTML_TEMP /wattsi-output/output.txt
223
+ echo
224
+ echo " Found fatal errors. Stopping."
225
+ exit 1
198
226
fi
199
227
200
228
cat $HTML_TEMP /wattsi-output/index-html | perl .post-process-index-generator.pl | perl .post-process-partial-backlink-generator.pl > $HTML_OUTPUT /index;
0 commit comments