diff --git a/Checks b/Checks index c3a989f4..47847c57 100644 --- a/Checks +++ b/Checks @@ -1,7 +1,15 @@ -deploy_check :internal_links -deploy_check :mixed_content -deploy_check :stale -deploy_check :no_unprocessed_erb +require 'open3' +require 'json' + +check :html5 do + cmd = "java -jar opt/validator/vnu.jar --format json --skip-non-html --schema http://s.validator.nu/html5-all.rnc #{@config[:output_dir]}" + res = Open3.popen3(cmd) { |_stdin, _stdout, stderr| stderr.read } + + JSON.parse(res).fetch('messages', []).each do |err| + subject = err['url'].sub(/^file:#{Regexp.escape File.dirname(__FILE__)}\//, '') + add_issue("#{err['message']} (line #{err['lastLine']}, column #{err['firstColumn']})", subject: subject) + end +end check :no_unprocessed_erb do @output_filenames.each do |filename| @@ -11,4 +19,11 @@ check :no_unprocessed_erb do end end + +deploy_check :internal_links +deploy_check :mixed_content +deploy_check :stale +deploy_check :no_unprocessed_erb +deploy_check :no_unprocessed_markdown + # vi: ft=ruby diff --git a/opt/validator/VERSION b/opt/validator/VERSION new file mode 100644 index 00000000..4f339b76 --- /dev/null +++ b/opt/validator/VERSION @@ -0,0 +1 @@ +16.10.27 \ No newline at end of file diff --git a/opt/validator/vnu.jar b/opt/validator/vnu.jar new file mode 100644 index 00000000..a53a4e08 Binary files /dev/null and b/opt/validator/vnu.jar differ