All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Vivian De Smedt <vds2212@gmail.com>, Adrian Vollmer <computerfluesterer@protonmail.com>
2 " Description: Adds support for djlint
4 function! ale#handlers#djlint#GetExecutable(buffer) abort
5 return ale#Var(a:buffer, 'html_djlint_executable')
8 function! ale#handlers#djlint#GetCommand(buffer) abort
9 let l:executable = ale#handlers#djlint#GetExecutable(a:buffer)
11 let l:options = ale#Var(a:buffer, 'html_djlint_options')
14 let l:filetypes = split(getbufvar(a:buffer, '&filetype'), '\.')
16 " Append the --profile flag depending on the current filetype (unless it's
17 " already set in g:html_djlint_options).
18 if match(l:options, '--profile') == -1
19 let l:djlint_profiles = {
21 \ 'htmldjango': 'django',
23 \ 'nunjucks': 'nunjucks',
24 \ 'handlebars': 'handlebars',
25 \ 'gohtmltmpl': 'golang',
26 \ 'htmlangular': 'angular',
29 for l:filetype in l:filetypes
30 if has_key(l:djlint_profiles, l:filetype)
31 let l:profile = l:djlint_profiles[l:filetype]
38 let l:options = (!empty(l:options) ? l:options . ' ' : '') . '--profile ' . l:profile
41 return ale#Escape(l:executable)
42 \ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
45 function! ale#handlers#djlint#Handle(buffer, lines) abort
47 let l:pattern = '\v^([A-Z]\d+) (\d+):(\d+) (.*)$'
50 for l:match in ale#util#GetMatches(a:lines, l:pattern)
53 \ 'lnum': l:match[2] + 0,
54 \ 'col': l:match[3] + 0,
60 call add(l:output, l:item)