Skip to content

Instantly share code, notes, and snippets.

@samber
Last active September 11, 2018 09:09
Show Gist options
  • Save samber/db98fd083efa0d763e4d888f37c2935f to your computer and use it in GitHub Desktop.
Save samber/db98fd083efa0d763e4d888f37c2935f to your computer and use it in GitHub Desktop.
html validation script (epitech)
<html>
<body>
<p>
</body>
</html>
#!/bin/bash
if [ $# != 2 ]; then
echo "usage: ./validate-w3c-html.sh <index.html> <error|info>"
exit 1
fi
html_file=$1
log_level=$2
function check() {
echo "[$1]"
curl -H "Content-Type: text/html; charset=utf-8" \
--data-binary @${html_file} -s \
https://validator.w3.org/nu/?out=json | jq -r '.messages[] | select(.type=="'${1}'") | .message'
echo
}
check "error"
if [ ${log_level} = "info" ]; then
check "info"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment