-
Notifications
You must be signed in to change notification settings - Fork 367
/
latexDocumentationViewer.py
61 lines (46 loc) · 1.58 KB
/
latexDocumentationViewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import traceback
import sublime
import sublime_plugin
from .deprecated_command import deprecate
from .latextools_utils.distro_utils import using_miktex
from .latextools_utils.external_command import external_command
def _view_texdoc(file):
if file is None:
raise Exception('File must be specified')
if not isinstance(file, str):
raise TypeError('File must be a string')
command = ['texdoc']
if using_miktex():
command.append('--view')
command.append(file)
try:
external_command(command)
except OSError:
traceback.print_exc()
sublime.error_message(
'Could not run texdoc. Please ensure that your texpath setting '
'is configured correctly in the LaTeXTools settings.')
class LatextoolsPkgDocCommand(sublime_plugin.WindowCommand):
def run(self):
window = self.window
def _on_done(file):
if (
file is not None and
isinstance(file, str) and
file != ''
):
window.run_command('latextools_view_doc', {'file': file})
window.show_input_panel(
'View documentation for which package?',
'',
_on_done,
None,
None
)
class LatextoolsViewDocCommand(sublime_plugin.WindowCommand):
def run(self, file):
_view_texdoc(file)
def is_visible(self):
return False # hide this from menu
deprecate(globals(), 'LatexPkgDocCommand', LatextoolsPkgDocCommand)
deprecate(globals(), 'LatexViewDocCommand', LatextoolsViewDocCommand)