diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-15 13:35:54 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-15 13:36:16 +0100 |
commit | 706dd050f2ec570eb12398d42a18f6c4f2bd56df (patch) | |
tree | 2c463aa0d5ef02feab3f2ef87215bd4417b47729 /ale_linters/html | |
parent | 2f009690c3cf442f828830cc1d2fece619f308ff (diff) | |
download | ale-706dd050f2ec570eb12398d42a18f6c4f2bd56df.zip |
Fix #257 in preparation for #427, standardise options with fallbacks, and make it so every value can be computed dynamically
Diffstat (limited to 'ale_linters/html')
-rw-r--r-- | ale_linters/html/tidy.vim | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ale_linters/html/tidy.vim b/ale_linters/html/tidy.vim index 9067f9d4..eab07a0f 100644 --- a/ale_linters/html/tidy.vim +++ b/ale_linters/html/tidy.vim @@ -3,7 +3,9 @@ " CLI options let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy') -let g:ale_html_tidy_args = get(g:, 'ale_html_tidy_args', '-q -e -language en') +" Look for the old _args variable first. +let s:default_options = get(g:, 'ale_html_tidy_args', '-q -e -language en') +let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', s:default_options) function! ale_linters#html#tidy#GetCommand(buffer) abort " Specify file encoding in options @@ -25,9 +27,13 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort return printf('%s %s %s -', \ g:ale_html_tidy_executable, - \ g:ale_html_tidy_args, + \ g:ale_html_tidy_options, \ l:file_encoding - \ ) + \) +endfunction + +function! ale_linters#html#tidy#GetExecutable(buffer) abort + return g:ale_html_tidy_executable endfunction function! ale_linters#html#tidy#Handle(buffer, lines) abort @@ -63,7 +69,7 @@ endfunction call ale#linter#Define('html', { \ 'name': 'tidy', -\ 'executable': g:ale_html_tidy_executable, +\ 'executable_callback': 'ale_linters#html#tidy#GetExecutable', \ 'output_stream': 'stderr', \ 'command_callback': 'ale_linters#html#tidy#GetCommand', \ 'callback': 'ale_linters#html#tidy#Handle', |