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:
Karl Yngve Lervåg 2014-02-04 13:16:48 +01:00
parent 587f560c41
commit 678193b362
2 changed files with 10 additions and 10 deletions

View File

@ -88,7 +88,7 @@ endfunction
" {{{1 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)
echomsg "Can't view: Output file is not readable!"
return
@ -118,10 +118,10 @@ function! s:init_environment()
let b:latex.id = id
else
let data = {}
let data.tex = shellescape(main)
let data.root = shellescape(fnamemodify(data.tex, ':h'))
let data.base = shellescape(fnamemodify(data.tex, ':t'))
let data.name = shellescape(fnamemodify(data.tex, ':t:r'))
let data.tex = main
let data.root = fnamemodify(data.tex, ':h')
let data.base = fnamemodify(data.tex, ':t')
let data.name = fnamemodify(data.tex, ':t:r')
function data.aux() dict
return s:get_main_ext(self, 'aux')
endfunction
@ -282,7 +282,7 @@ function! s:get_main_ext(texdata, ext)
for f in map(candidates,
\ 'a:texdata.root . ''/'' . v:val . ''.'' . a:ext')
if filereadable(f)
return shellescape(fnamemodify(f, ':p'))
return fnamemodify(f, ':p')
endif
endfor

View File

@ -57,13 +57,13 @@ function! latex#latexmk#clean(...)
"
" Run latexmk clean process
"
let cmd = '!cd ' . data.root . ';'
let cmd = '!cd ' . shellescape(data.root) . ';'
if full
let cmd .= 'latexmk -C '
else
let cmd .= 'latexmk -c '
endif
let cmd .= data.base . ' &>/dev/null'
let cmd .= shellescape(data.base) . ' &>/dev/null'
let g:latex#data[b:latex.id].clean_cmd = cmd
call s:execute(cmd)
@ -85,7 +85,7 @@ function! latex#latexmk#compile()
"
" 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 .= ' -' . g:latex_latexmk_output
let cmd .= ' -quiet '
@ -93,7 +93,7 @@ function! latex#latexmk#compile()
let cmd .= ' ' . g:latex_latexmk_options
let cmd .= ' -e ' . shellescape('$pdflatex =~ 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 g:latex#data[b:latex.id].cmd = cmd