From 9c0710688eece622252601d9989eecc3b685c5e6 Mon Sep 17 00:00:00 2001 From: Kevin Lane Date: Sun, 13 Oct 2024 11:24:34 -0700 Subject: [PATCH] Cleanup debug printing --- jekyllnb/exporter.py | 22 ++++++---------------- tests/test_nbconvert.py | 7 +------ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/jekyllnb/exporter.py b/jekyllnb/exporter.py index 80fcff1..4afe14c 100644 --- a/jekyllnb/exporter.py +++ b/jekyllnb/exporter.py @@ -55,22 +55,12 @@ def default_config(self) -> Config: def _jekyll_path(self, path: str) -> str: site_dir = self.resources.get("site_dir") - print("=" * 50) - print("exporter") - print(f"path: {path}") - print(f"site_dir: {site_dir}") - if site_dir and (_path := Path(path)).is_relative_to(site_dir): - relative_path = str(_path.relative_to(site_dir)) - url = path2url(relative_path) - print(f"resolved path: {_path}") - print(f"relative path: {relative_path}") - else: - print("path is already relative") - url = path2url(path) - - print(f"url: {url}") - print("=" * 50) - return f"{{{{ site.baseurl }}}}/{url}" + _path = Path(path) + + if site_dir and _path.is_relative_to(site_dir): + path = str(_path.relative_to(site_dir)) + + return f"{{{{ site.baseurl }}}}/{path2url(path)}" def default_filters(self) -> list[tuple[str, Callable]]: """Specify default filters.""" diff --git a/tests/test_nbconvert.py b/tests/test_nbconvert.py index c044d0e..f60fe9e 100644 --- a/tests/test_nbconvert.py +++ b/tests/test_nbconvert.py @@ -28,7 +28,7 @@ class TestNbConvert(Config): @pytest.fixture def args(self, site_dir: Path, input_file: Path) -> list[str]: - args = [ + return [ "--to", "jekyll", "--output-dir", @@ -36,8 +36,3 @@ def args(self, site_dir: Path, input_file: Path) -> list[str]: "--NbConvertApp.output_files_dir=" + os.path.join(IMAGE_DIR, FILE_NAME), str(input_file), ] - print("=" * 50) - print("test") - print(args) - print("=" * 50) - return args