mirror of https://github.com/dense-analysis/ale
Add htmlbeautifier support (#4751)
This commit is contained in:
parent
6db58b3379
commit
7516e2e484
|
@ -561,6 +561,11 @@ let s:default_registry = {
|
|||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify from js-beautify.',
|
||||
\ },
|
||||
\ 'htmlbeautifier': {
|
||||
\ 'function': 'ale#fixers#htmlbeautifier#Fix',
|
||||
\ 'suggested_filetypes': ['eruby'],
|
||||
\ 'description': 'Fix ERB files with htmlbeautifier gem.',
|
||||
\ },
|
||||
\ 'lua-format': {
|
||||
\ 'function': 'ale#fixers#lua_format#Fix',
|
||||
\ 'suggested_filetypes': ['lua'],
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
" Author: Arash Mousavi <arash-m>
|
||||
" Description: Support for HTML Beautifier https://github.com/threedaymonk/htmlbeautifier
|
||||
|
||||
call ale#Set('eruby_htmlbeautifier_executable', 'htmlbeautifier')
|
||||
|
||||
function! ale#fixers#htmlbeautifier#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'eruby_htmlbeautifier_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
|
@ -7,6 +7,7 @@ There are four linters for `eruby` files:
|
|||
- `erblint`
|
||||
- `erubis`
|
||||
- `erubi`
|
||||
- `htmlbeautifier`
|
||||
- `ruumba`
|
||||
|
||||
`erb` is in the Ruby standard library and is mostly universal. `erubis` is the
|
||||
|
@ -47,6 +48,18 @@ g:ale_eruby_erblint_options *g:ale_ruby_erblint_options*
|
|||
This variable can be change to modify flags given to erblint.
|
||||
|
||||
|
||||
===============================================================================
|
||||
htmlbeautifier *ale-eruby-htmlbeautifier*
|
||||
|
||||
g:ale_eruby_htmlbeautifier_executable *g:ale_eruby_htmlbeautifier_executable*
|
||||
*b:ale_eruby_htmlbeautifier_executable*
|
||||
Type: |String|
|
||||
Default: `'htmlbeautifier'`
|
||||
|
||||
Override the invoked htmlbeautifier binary. This is useful for running
|
||||
htmlbeautifier from binstubs or a bundle.
|
||||
|
||||
|
||||
===============================================================================
|
||||
ruumba *ale-eruby-ruumba*
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ Notes:
|
|||
* `erblint`
|
||||
* `erubi`
|
||||
* `erubis`
|
||||
* `htmlbeautifier`
|
||||
* `ruumba`
|
||||
* Erlang
|
||||
* `SyntaxErl`
|
||||
|
|
|
@ -3020,6 +3020,7 @@ documented in additional help files.
|
|||
eruby...................................|ale-eruby-options|
|
||||
erb-formatter.........................|ale-eruby-erbformatter|
|
||||
erblint...............................|ale-eruby-erblint|
|
||||
htmlbeautifier........................|ale-eruby-htmlbeautifier|
|
||||
ruumba................................|ale-eruby-ruumba|
|
||||
fish....................................|ale-fish-options|
|
||||
fish_indent...........................|ale-fish-fish_indent|
|
||||
|
|
|
@ -191,6 +191,7 @@ formatting.
|
|||
* [erblint](https://github.com/Shopify/erb-lint)
|
||||
* [erubi](https://github.com/jeremyevans/erubi)
|
||||
* [erubis](https://github.com/kwatch/erubis)
|
||||
* [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier)
|
||||
* [ruumba](https://github.com/ericqweinstein/ruumba)
|
||||
* Erlang
|
||||
* [SyntaxErl](https://github.com/ten0s/syntaxerl)
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
Before:
|
||||
call ale#assert#SetUpFixerTest('eruby', 'htmlbeautifier')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The htmlbeautifier callback should return the correct default values):
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('htmlbeautifier') . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
Execute(The htmlbeautifier callback should allow custom htmlbeautifier executables):
|
||||
let g:ale_eruby_htmlbeautifier_executable = 'foo/bar'
|
||||
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('foo/bar') . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
Loading…
Reference in New Issue