Fixed #629: Subfiles class is not a main file
This commit is contained in:
parent
d382cb4d4f
commit
e2f8b0dd3b
@ -667,12 +667,16 @@ endfunction
|
|||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
function! s:file_is_main(file) " {{{1
|
function! s:file_is_main(file) " {{{1
|
||||||
|
if !filereadable(a:file) | return 0 | endif
|
||||||
|
|
||||||
"
|
"
|
||||||
" Check if a:file is a main file
|
" Check if a:file is a main file by looking for the \documentclass command,
|
||||||
|
" but ignore \documentclass[...]{subfiles}
|
||||||
"
|
"
|
||||||
return filereadable(a:file)
|
let l:lines = readfile(a:file, 0, 50)
|
||||||
\ && len(filter(readfile(a:file, 0, 50),
|
call filter(l:lines, 'v:val !~# ''{subfiles}''')
|
||||||
\ 'v:val =~# ''\C\\documentclass\_\s*[\[{]''')) > 0
|
call filter(l:lines, 'v:val =~# ''\C\\documentclass\_\s*[\[{]''')
|
||||||
|
return len(l:lines) > 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user