mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-27 05:12:16 +08:00
Add support for html-beautify (#2788)
* Add support for html-beautify * Add html-beautify to the list of supported tools * Update docs
This commit is contained in:
committed by
w0rp
parent
af8c8516d1
commit
47eb3dd0c0
@@ -350,6 +350,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['nix'],
|
||||
\ 'description': 'A formatter for Nix code',
|
||||
\ },
|
||||
\ 'html-beautify': {
|
||||
\ 'function': 'ale#fixers#html_beautify#Fix',
|
||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
21
autoload/ale/fixers/html_beautify.vim
Normal file
21
autoload/ale/fixers/html_beautify.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author: WhyNotHugo <hugo@barrera.io>
|
||||
" Description: Lint HTML files with html-beautify.
|
||||
"
|
||||
call ale#Set('html_beautify_executable', 'html-beautify')
|
||||
call ale#Set('html_beautify_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('html_beautify_options', '')
|
||||
call ale#Set('html_beautify_change_directory', 1)
|
||||
|
||||
function! ale#fixers#html_beautify#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'html_beautify',
|
||||
\ ['html-beautify']
|
||||
\)
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'html_beautify_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable). ' ' . l:options . ' -',
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user