diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-03-26 09:42:22 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-03-26 15:19:11 +0100 |
commit | a98a223e1376c31a8e9c21af0b52e022c11b9e85 (patch) | |
tree | 667cc46fd2e51f567a14d798bb9817371f4670e3 /utils | |
parent | f5d76dd5bb174115be559ecf5128a0c12eb6794f (diff) | |
download | novnc-a98a223e1376c31a8e9c21af0b52e022c11b9e85.tar.gz |
Validate HTML and CSS in Travis
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/validate | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/utils/validate b/utils/validate new file mode 100755 index 0000000..a6b5507 --- /dev/null +++ b/utils/validate @@ -0,0 +1,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 |