function s:_compile(verbose, ...)
  :execute(":w!")
  if a:verbose
    execute "!" . "compile" . " " . "\"%:p\"" . " " . join(a:000)
  else
    silent execute "!" . "compile" . " " . "\"%:p\"" . " " . join(a:000)
  endif
endfunction

function s:_open(verbose, ...)
  if a:verbose
    execute "!" . "open-compiled" . " " . "\"%\"" . " " . join(a:000)
  else
    silent execute "!" . "open-compiled" . " " . "\"%\"" . " " . join(a:000)
  endif
endfunction

function s:_compileopen(verbose, ...)
  call s:_compile(a:verbose, join(a:000))
  call s:_open(a:verbose, join(a:000))
endfunction

command -bang -nargs=* DocCompile call s:_compile(<bang>0, <f-args>)
command -bang -nargs=* DocCompileOpen call s:_compileopen(<bang>0, <f-args>)
command -bang -nargs=* DocOpen call s:_open(<bang>0, <f-args>)
