mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Add htmlbeautifier support (#4751)
This commit is contained in:
@@ -561,6 +561,11 @@ let s:default_registry = {
|
|||||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||||
\ 'description': 'Fix HTML files with html-beautify from js-beautify.',
|
\ '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': {
|
\ 'lua-format': {
|
||||||
\ 'function': 'ale#fixers#lua_format#Fix',
|
\ 'function': 'ale#fixers#lua_format#Fix',
|
||||||
\ 'suggested_filetypes': ['lua'],
|
\ 'suggested_filetypes': ['lua'],
|
||||||
|
|||||||
13
autoload/ale/fixers/htmlbeautifier.vim
Normal file
13
autoload/ale/fixers/htmlbeautifier.vim
Normal file
@@ -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`
|
- `erblint`
|
||||||
- `erubis`
|
- `erubis`
|
||||||
- `erubi`
|
- `erubi`
|
||||||
|
- `htmlbeautifier`
|
||||||
- `ruumba`
|
- `ruumba`
|
||||||
|
|
||||||
`erb` is in the Ruby standard library and is mostly universal. `erubis` is the
|
`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.
|
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*
|
ruumba *ale-eruby-ruumba*
|
||||||
|
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ Notes:
|
|||||||
* `erblint`
|
* `erblint`
|
||||||
* `erubi`
|
* `erubi`
|
||||||
* `erubis`
|
* `erubis`
|
||||||
|
* `htmlbeautifier`
|
||||||
* `ruumba`
|
* `ruumba`
|
||||||
* Erlang
|
* Erlang
|
||||||
* `SyntaxErl`
|
* `SyntaxErl`
|
||||||
|
|||||||
@@ -3020,6 +3020,7 @@ documented in additional help files.
|
|||||||
eruby...................................|ale-eruby-options|
|
eruby...................................|ale-eruby-options|
|
||||||
erb-formatter.........................|ale-eruby-erbformatter|
|
erb-formatter.........................|ale-eruby-erbformatter|
|
||||||
erblint...............................|ale-eruby-erblint|
|
erblint...............................|ale-eruby-erblint|
|
||||||
|
htmlbeautifier........................|ale-eruby-htmlbeautifier|
|
||||||
ruumba................................|ale-eruby-ruumba|
|
ruumba................................|ale-eruby-ruumba|
|
||||||
fish....................................|ale-fish-options|
|
fish....................................|ale-fish-options|
|
||||||
fish_indent...........................|ale-fish-fish_indent|
|
fish_indent...........................|ale-fish-fish_indent|
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ formatting.
|
|||||||
* [erblint](https://github.com/Shopify/erb-lint)
|
* [erblint](https://github.com/Shopify/erb-lint)
|
||||||
* [erubi](https://github.com/jeremyevans/erubi)
|
* [erubi](https://github.com/jeremyevans/erubi)
|
||||||
* [erubis](https://github.com/kwatch/erubis)
|
* [erubis](https://github.com/kwatch/erubis)
|
||||||
|
* [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier)
|
||||||
* [ruumba](https://github.com/ericqweinstein/ruumba)
|
* [ruumba](https://github.com/ericqweinstein/ruumba)
|
||||||
* Erlang
|
* Erlang
|
||||||
* [SyntaxErl](https://github.com/ten0s/syntaxerl)
|
* [SyntaxErl](https://github.com/ten0s/syntaxerl)
|
||||||
|
|||||||
19
test/fixers/test_htmlbeautifier_fixer_callback.vader
Normal file
19
test/fixers/test_htmlbeautifier_fixer_callback.vader
Normal file
@@ -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,
|
||||||
|
\}
|
||||||
Reference in New Issue
Block a user