Use shellescape at the right locations
Shellescape should only be used when variables/strings are used in the shell directly. See #9.
This commit is contained in:
parent
587f560c41
commit
678193b362
@ -88,7 +88,7 @@ endfunction
|
|||||||
|
|
||||||
" {{{1 latex#view
|
" {{{1 latex#view
|
||||||
function! latex#view()
|
function! latex#view()
|
||||||
let outfile = g:latex#data[b:latex.id].out()
|
let outfile = shellescape(g:latex#data[b:latex.id].out())
|
||||||
if !filereadable(outfile)
|
if !filereadable(outfile)
|
||||||
echomsg "Can't view: Output file is not readable!"
|
echomsg "Can't view: Output file is not readable!"
|
||||||
return
|
return
|
||||||
@ -118,10 +118,10 @@ function! s:init_environment()
|
|||||||
let b:latex.id = id
|
let b:latex.id = id
|
||||||
else
|
else
|
||||||
let data = {}
|
let data = {}
|
||||||
let data.tex = shellescape(main)
|
let data.tex = main
|
||||||
let data.root = shellescape(fnamemodify(data.tex, ':h'))
|
let data.root = fnamemodify(data.tex, ':h')
|
||||||
let data.base = shellescape(fnamemodify(data.tex, ':t'))
|
let data.base = fnamemodify(data.tex, ':t')
|
||||||
let data.name = shellescape(fnamemodify(data.tex, ':t:r'))
|
let data.name = fnamemodify(data.tex, ':t:r')
|
||||||
function data.aux() dict
|
function data.aux() dict
|
||||||
return s:get_main_ext(self, 'aux')
|
return s:get_main_ext(self, 'aux')
|
||||||
endfunction
|
endfunction
|
||||||
@ -282,7 +282,7 @@ function! s:get_main_ext(texdata, ext)
|
|||||||
for f in map(candidates,
|
for f in map(candidates,
|
||||||
\ 'a:texdata.root . ''/'' . v:val . ''.'' . a:ext')
|
\ 'a:texdata.root . ''/'' . v:val . ''.'' . a:ext')
|
||||||
if filereadable(f)
|
if filereadable(f)
|
||||||
return shellescape(fnamemodify(f, ':p'))
|
return fnamemodify(f, ':p')
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ function! latex#latexmk#clean(...)
|
|||||||
"
|
"
|
||||||
" Run latexmk clean process
|
" Run latexmk clean process
|
||||||
"
|
"
|
||||||
let cmd = '!cd ' . data.root . ';'
|
let cmd = '!cd ' . shellescape(data.root) . ';'
|
||||||
if full
|
if full
|
||||||
let cmd .= 'latexmk -C '
|
let cmd .= 'latexmk -C '
|
||||||
else
|
else
|
||||||
let cmd .= 'latexmk -c '
|
let cmd .= 'latexmk -c '
|
||||||
endif
|
endif
|
||||||
let cmd .= data.base . ' &>/dev/null'
|
let cmd .= shellescape(data.base) . ' &>/dev/null'
|
||||||
let g:latex#data[b:latex.id].clean_cmd = cmd
|
let g:latex#data[b:latex.id].clean_cmd = cmd
|
||||||
|
|
||||||
call s:execute(cmd)
|
call s:execute(cmd)
|
||||||
@ -85,7 +85,7 @@ function! latex#latexmk#compile()
|
|||||||
"
|
"
|
||||||
" Set latexmk command with options
|
" Set latexmk command with options
|
||||||
"
|
"
|
||||||
let cmd = '!cd ' . data.root . ' && '
|
let cmd = '!cd ' . shellescape(data.root) . ' && '
|
||||||
let cmd .= 'max_print_line=2000 latexmk'
|
let cmd .= 'max_print_line=2000 latexmk'
|
||||||
let cmd .= ' -' . g:latex_latexmk_output
|
let cmd .= ' -' . g:latex_latexmk_output
|
||||||
let cmd .= ' -quiet '
|
let cmd .= ' -quiet '
|
||||||
@ -93,7 +93,7 @@ function! latex#latexmk#compile()
|
|||||||
let cmd .= ' ' . g:latex_latexmk_options
|
let cmd .= ' ' . g:latex_latexmk_options
|
||||||
let cmd .= ' -e ' . shellescape('$pdflatex =~ s/ / -file-line-error /')
|
let cmd .= ' -e ' . shellescape('$pdflatex =~ s/ / -file-line-error /')
|
||||||
let cmd .= ' -e ' . shellescape('$latex =~ s/ / -file-line-error /')
|
let cmd .= ' -e ' . shellescape('$latex =~ s/ / -file-line-error /')
|
||||||
let cmd .= ' ' . data.base
|
let cmd .= ' ' . shellescape(data.base)
|
||||||
let cmd .= ' &>/dev/null &'
|
let cmd .= ' &>/dev/null &'
|
||||||
let g:latex#data[b:latex.id].cmd = cmd
|
let g:latex#data[b:latex.id].cmd = cmd
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user