Merge pull request #1262 from rhysd/avoid-old-tidy

html: Avoid old tidy on macOS
This commit is contained in:
w0rp 2018-01-07 16:02:49 +00:00 committed by GitHub
commit f1747901cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -25,8 +25,16 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
\ 'utf-8': '-utf8', \ 'utf-8': '-utf8',
\ }, &fileencoding, '-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 -', return printf('%s %s %s -',
\ ale#Var(a:buffer, 'html_tidy_executable'), \ l:executable,
\ ale#Var(a:buffer, 'html_tidy_options'), \ ale#Var(a:buffer, 'html_tidy_options'),
\ l:file_encoding \ l:file_encoding
\) \)

View File

@ -32,6 +32,21 @@ g:ale_html_htmlhint_use_global *g:ale_html_htmlhint_use_global*
=============================================================================== ===============================================================================
tidy *ale-html-tidy* tidy *ale-html-tidy*
`tidy` is a console application which corrects and cleans up HTML and XML
documents by fixing markup errors and upgrading legacy code to modern
standards.
Note:
`/usr/bin/tidy` on macOS (installed by default) is too old. It was released
on 31 Oct 2006. It does not consider modern HTML specs (HTML5) and shows
outdated warnings. So |ale| ignores `/usr/bin/tidy` on macOS.
To use `tidy` on macOS, please install the latest version with Homebrew:
>
$ brew install tidy-html5
<
`/usr/local/bin/tidy` is installed.
g:ale_html_tidy_executable *g:ale_html_tidy_executable* g:ale_html_tidy_executable *g:ale_html_tidy_executable*
*b:ale_html_tidy_executable* *b:ale_html_tidy_executable*
Type: |String| Type: |String|