blob: a6b5507d2ac04f28721151a618608938864bf5e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/bash
set -e
RET=0
OUT=`mktemp`
for fn in "$@"; do
echo "Validating $fn..."
echo
case $fn in
*.html)
type="text/html"
;;
*.css)
type="text/css"
;;
*)
echo "Unknown format!"
echo
RET=1
continue
;;
esac
curl --silent \
--header "Content-Type: ${type}; charset=utf-8" \
--data-binary @${fn} \
https://validator.w3.org/nu/?out=text > $OUT
cat $OUT
echo
# We don't fail the check for warnings as some warnings are
# not relevant for us, and we don't currently have a way to
# ignore just those
if grep -q -s -E "^Error:" $OUT; then
RET=1
fi
done
rm $OUT
exit $RET
|