From 062be727699f5dd4d8daaa53757775a5ff49e4a6 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 17 Dec 2025 14:31:40 +0000 Subject: [PATCH 1/2] :zap: Don't print custom template locations when in quiet mode --- ChangeLog.md | 7 +++++++ src/ng2web/ng2web.py | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 9b872ea..3ae1f76 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,12 @@ # ng2web ChangeLog +## Unreleased + +**Released: WiP** + +- Don't print template locations when using custom templates, when quiet + mode is requested. + ## v1.5.1 **Released: 2025-12-08** diff --git a/src/ng2web/ng2web.py b/src/ng2web/ng2web.py index 51f6c52..68b9c8c 100644 --- a/src/ng2web/ng2web.py +++ b/src/ng2web/ng2web.py @@ -385,11 +385,12 @@ def page_title(guide: NortonGuide, entry: Entry | None = None) -> str: ############################################################################## -def make_loader(templates: Path | None) -> ChoiceLoader: +def make_loader(templates: Path | None, quietly: bool) -> ChoiceLoader: """Make the template loader. Args: templates: Optional directory for template overrides. + quietly: Make without logging? Returns: Returns the template loader object. @@ -397,12 +398,14 @@ def make_loader(templates: Path | None) -> ChoiceLoader: loaders: list[FileSystemLoader] = [] if templates is not None: if (templates := templates.expanduser().resolve()).is_dir(): - log(f"Adding {templates} to the template path") + if not quietly: + log(f"Adding {templates} to the template path") loaders.append(FileSystemLoader(str(templates), followlinks=True)) else: log(f"Ignoring {templates} as a template location as it does not exist") if (local_templates := Path("templates").resolve()).is_dir(): - log(f"Adding {local_templates} to the template path") + if not quietly: + log(f"Adding {local_templates} to the template path") loaders.append(FileSystemLoader(str(local_templates), followlinks=True)) return ChoiceLoader(loaders + [PackageLoader(Path(__file__).stem)]) @@ -444,7 +447,8 @@ def to_html(args: argparse.Namespace) -> None: # Bootstrap the template stuff. env = Environment( - loader=make_loader(args.templates), autoescape=select_autoescape() + loader=make_loader(args.templates, args.quiet), + autoescape=select_autoescape(), ) # Set up the global variables for template expansion. From d1b9ce1bb97d58c6b8b69418da71ca4070bf75fa Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 17 Dec 2025 14:33:34 +0000 Subject: [PATCH 2/2] :books: Link the ChangeLog to the PR --- ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 3ae1f76..c33e2cd 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,7 +5,7 @@ **Released: WiP** - Don't print template locations when using custom templates, when quiet - mode is requested. + mode is requested. ([#53](https://github.com/davep/ng2web/pull/53)) ## v1.5.1