From 04a410a85ba23cf93f57546675c2e5147429acc6 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Tue, 2 Aug 2022 03:01:26 +0000 Subject: [PATCH] fix: Improve error message when a scan fails (#19) Also syncs somewhat better with the latest release of mkdocs-simple-plugin and corrects some typos. Co-authored-by: Glen Whitney Reviewed-on: https://code.studioinfinity.org/glen/mkdocs-semiliterate/pulls/19 --- .drone.yml | 2 +- mkdocs_semiliterate/plugin.py | 10 +++++----- setup.cfg | 2 +- tests/fixtures/extract-inclusion/refsite/css/base.css | 2 +- tests/fixtures/full-inclusion/refsite/css/base.css | 2 +- tests/fixtures/git-inclusion/refsite/css/base.css | 2 +- .../fixtures/no-extract-inclusion/refsite/css/base.css | 2 +- tests/fixtures/quoted-filename/refsite/css/base.css | 2 +- .../fixtures/recursive-inclusion/refsite/css/base.css | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index 191ae8e..4d93cc5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,7 +33,7 @@ steps: ### develop # ### Testing # -# If you have a a Docker daemon running on your local machine and the Drone +# If you have a Docker daemon running on your local machine and the Drone # [command-line](https://readme.drone.io/cli/install) installed, you can run all # of the tests via `drone exec`. If not, or if you don't want to wait for the # Docker container to spin up and install all of the prerequisites, you can make diff --git a/mkdocs_semiliterate/plugin.py b/mkdocs_semiliterate/plugin.py index 94894f5..419eea7 100644 --- a/mkdocs_semiliterate/plugin.py +++ b/mkdocs_semiliterate/plugin.py @@ -420,8 +420,7 @@ semiliterate.ensurelines from_file_path = os.path.join(from_directory, from_file) try: with open(from_file_path) as original_file: - utils.log.debug( - "mkdocs-simple-plugin: Scanning {}...".format(from_file)) + utils.log.debug(f"mkdocs-semiliterate: Scanning {from_file}...") # extraction = StreamExtract( extraction = StreamInclusion( input_stream=original_file, @@ -432,7 +431,8 @@ semiliterate.ensurelines patterns=self.patterns, **kwargs) return extraction.extract() - except BaseException: - utils.log.error("mkdocs-simple-plugin: could not build {}".format( - from_file_path)) + except BaseException as error: + utils.log.error( + f"mkdocs-semiliterate: could not build {from_file_path}:\n " + + str(error)) return False diff --git a/setup.cfg b/setup.cfg index 200050d..f483d94 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mkdocs-semiliterate -version = 0.4.0 +version = 0.4.1 description = Extension of mkdocs-simple-plugin adding easy content inclusion long_description = file: README.md long_description_content_type = text/markdown diff --git a/tests/fixtures/extract-inclusion/refsite/css/base.css b/tests/fixtures/extract-inclusion/refsite/css/base.css index 13f6c91..25e17a6 100644 --- a/tests/fixtures/extract-inclusion/refsite/css/base.css +++ b/tests/fixtures/extract-inclusion/refsite/css/base.css @@ -209,7 +209,7 @@ footer { padding-left: .5em; } -h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink{ +h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink { display:inline-block; } diff --git a/tests/fixtures/full-inclusion/refsite/css/base.css b/tests/fixtures/full-inclusion/refsite/css/base.css index 13f6c91..25e17a6 100644 --- a/tests/fixtures/full-inclusion/refsite/css/base.css +++ b/tests/fixtures/full-inclusion/refsite/css/base.css @@ -209,7 +209,7 @@ footer { padding-left: .5em; } -h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink{ +h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink { display:inline-block; } diff --git a/tests/fixtures/git-inclusion/refsite/css/base.css b/tests/fixtures/git-inclusion/refsite/css/base.css index 13f6c91..25e17a6 100644 --- a/tests/fixtures/git-inclusion/refsite/css/base.css +++ b/tests/fixtures/git-inclusion/refsite/css/base.css @@ -209,7 +209,7 @@ footer { padding-left: .5em; } -h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink{ +h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink { display:inline-block; } diff --git a/tests/fixtures/no-extract-inclusion/refsite/css/base.css b/tests/fixtures/no-extract-inclusion/refsite/css/base.css index 13f6c91..25e17a6 100644 --- a/tests/fixtures/no-extract-inclusion/refsite/css/base.css +++ b/tests/fixtures/no-extract-inclusion/refsite/css/base.css @@ -209,7 +209,7 @@ footer { padding-left: .5em; } -h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink{ +h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink { display:inline-block; } diff --git a/tests/fixtures/quoted-filename/refsite/css/base.css b/tests/fixtures/quoted-filename/refsite/css/base.css index 13f6c91..25e17a6 100644 --- a/tests/fixtures/quoted-filename/refsite/css/base.css +++ b/tests/fixtures/quoted-filename/refsite/css/base.css @@ -209,7 +209,7 @@ footer { padding-left: .5em; } -h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink{ +h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink { display:inline-block; } diff --git a/tests/fixtures/recursive-inclusion/refsite/css/base.css b/tests/fixtures/recursive-inclusion/refsite/css/base.css index 13f6c91..25e17a6 100644 --- a/tests/fixtures/recursive-inclusion/refsite/css/base.css +++ b/tests/fixtures/recursive-inclusion/refsite/css/base.css @@ -209,7 +209,7 @@ footer { padding-left: .5em; } -h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink{ +h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink { display:inline-block; }