Skip to content

Commit

Permalink
replace notebook_dir with root_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
naoh16 committed Sep 7, 2024
1 parent 204faf7 commit 6604b33
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions jupyterlab_latex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def load_jupyter_server_extension(nb_server_app):

handlers = [(f'{build}{path_regex}',
LatexBuildHandler,
{"notebook_dir": nb_server_app.notebook_dir}
{"root_dir": nb_server_app.root_dir}
),
(f'{synctex}{path_regex}',
LatexSynctexHandler,
{"notebook_dir": nb_server_app.notebook_dir}
{"root_dir": nb_server_app.root_dir}
)]
web_app.add_handlers('.*$', handlers)

Expand Down
6 changes: 3 additions & 3 deletions jupyterlab_latex/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class LatexBuildHandler(APIHandler):
A handler that runs LaTeX on the server.
"""

def initialize(self, notebook_dir):
self.notebook_dir = notebook_dir
def initialize(self, root_dir):
self.root_dir = root_dir


def build_tex_cmd_sequence(self, tex_base_name, run_bibtex=False):
Expand Down Expand Up @@ -179,7 +179,7 @@ def get(self, path = ''):
Given a path, run LaTeX, cleanup, and respond when done.
"""
# Parse the path into the base name and extension of the file
tex_file_path = os.path.join(self.notebook_dir, path.strip('/'))
tex_file_path = os.path.join(self.root_dir, path.strip('/'))
tex_base_name, ext = os.path.splitext(os.path.basename(tex_file_path))
c = LatexConfig(config=self.config)

Expand Down
12 changes: 6 additions & 6 deletions jupyterlab_latex/synctex.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class LatexSynctexHandler(APIHandler):
A handler that runs synctex on the server.
"""

def initialize(self, notebook_dir):
self.notebook_dir = notebook_dir
def initialize(self, root_dir):
self.root_dir = root_dir


def build_synctex_cmd(self, base_name, ext):
Expand Down Expand Up @@ -79,7 +79,7 @@ def build_synctex_edit_cmd(self, pdf_name, pos):
"""
c = LatexConfig(config=self.config)

pdf_path = os.path.join(self.notebook_dir, pdf_name+".pdf")
pdf_path = os.path.join(self.root_dir, pdf_name+".pdf")

cmd = (
c.synctex_command,
Expand Down Expand Up @@ -107,8 +107,8 @@ def build_synctex_view_cmd(self, tex_name, pos):
"""
c = LatexConfig(config=self.config)
pdf_path = os.path.join(self.notebook_dir, tex_name+".pdf")
tex_path = os.path.join(self.notebook_dir, tex_name+".tex")
pdf_path = os.path.join(self.root_dir, tex_name+".pdf")
tex_path = os.path.join(self.root_dir, tex_name+".tex")

cmd = (
c.synctex_command,
Expand Down Expand Up @@ -176,7 +176,7 @@ def get(self, path = ''):
# Parse the path into the base name and extension of the file
relative_file_path = str(Path(path.strip('/')))
relative_base_path = os.path.splitext(relative_file_path)[0]
full_file_path = os.path.join(self.notebook_dir, relative_file_path)
full_file_path = os.path.join(self.root_dir, relative_file_path)
workdir = os.path.dirname(full_file_path)
base_name, ext = os.path.splitext(os.path.basename(full_file_path))

Expand Down

0 comments on commit 6604b33

Please sign in to comment.