#!/bin/sh test_description='Validate html with tidy' . ./setup.sh test_url() { tidy_opt="-eq" test -z "$NO_TIDY_WARNINGS" || tidy_opt+=" --show-warnings no" cgit_url "$1" >tidy-$test_count.tmp || return sed -e "1,4d" tidy-$test_count.tmp >tidy-$test_count || return "$tidy" $tidy_opt tidy-$test_count rc=$? # tidy returns with exitcode 1 on warnings, 2 on error if test $rc = 2 then false else : fi } tidy=`which tidy 2>/dev/null` test -n "$tidy" || { skip_all='Skipping html validation tests: tidy not found' test_done exit } # Releases of tidy that predate HTML5 reject the semantic elements (header, # nav, main, footer) that cgit emits, reporting them as errors. Skip the # validation unless tidy is new enough to understand them. printf '\n