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: Horacio Sanson - https://github.com/hsanson
2 " Description: Support for bibclean linter for BibTeX files.
4 call ale#Set('bib_bibclean_executable', 'bibclean')
6 function! ale_linters#bib#bibclean#GetCommand(buffer) abort
7 let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
9 return ale#Escape(l:executable) . ' -file-position '
12 function! ale_linters#bib#bibclean#get_type(str) abort
20 function! ale_linters#bib#bibclean#match_msg(line) abort
21 " Legacy message pattern works for bibclean <= v2.11.4. If empty, try
22 " the new message pattern for bibtex > v2.11.4
23 let l:matches_legacy = matchlist(a:line, '^\(.*\) "stdin", line \(\d\+\): \(.*\)$')
25 return ! empty(l:matches_legacy) ? l:matches_legacy
26 \ : matchlist(a:line, '^\(.*\) stdin:\(\d\+\):\(.*\)$')
29 function! ale_linters#bib#bibclean#match_entry(line) abort
30 return matchlist(a:line, 'Entry input byte=.* line=\(.*\) column=\(.*\) output .*$')
33 function! ale_linters#bib#bibclean#match_value(line) abort
34 return matchlist(a:line, 'Value input byte=.* line=\(.*\) column=\(.*\) output .*$')
37 function! ale_linters#bib#bibclean#Handle(buffer, lines) abort
45 let l:mlist = ale_linters#bib#bibclean#match_msg(l:line)
48 let l:msg = l:mlist[3]
49 let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1])
53 let l:mlist = ale_linters#bib#bibclean#match_entry(l:line)
55 let l:mlist = ale_linters#bib#bibclean#match_value(l:line)
74 call ale#linter#Define('bib', {
76 \ 'executable': {b -> ale#Var(b, 'bib_bibclean_executable')},
77 \ 'command': function('ale_linters#bib#bibclean#GetCommand'),
78 \ 'output_stream': 'stderr',
79 \ 'callback': 'ale_linters#bib#bibclean#Handle',