From 401b964e9ce212bfaafd98f7ef075ab5f9d7c805 Mon Sep 17 00:00:00 2001 From: rhysd Date: Wed, 3 Jan 2018 01:42:08 +0900 Subject: [PATCH] html: Avoid old tidy on macOS On macOS, Apple's command line toolchain installs very old `tidy` command (It was released on 31 Oct 2006). It does not consider new specs such as HTML5 so we should avoid it. --- ale_linters/html/tidy.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ale_linters/html/tidy.vim b/ale_linters/html/tidy.vim index 4a55d62..34152c6 100644 --- a/ale_linters/html/tidy.vim +++ b/ale_linters/html/tidy.vim @@ -25,8 +25,16 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort \ 'utf-8': '-utf8', \ }, &fileencoding, '-utf8') + " On macOS, old tidy (released on 31 Oct 2006) is installed. It does not + " consider HTML5 so we should avoid it. + let l:executable = ale#Var(a:buffer, 'html_tidy_executable') + if has('mac') && l:executable is# 'tidy' && exists('*exepath') + \ && exepath(l:executable) is# '/usr/bin/tidy' + return '' + endif + return printf('%s %s %s -', - \ ale#Var(a:buffer, 'html_tidy_executable'), + \ l:executable, \ ale#Var(a:buffer, 'html_tidy_options'), \ l:file_encoding \)