From 2abe329dd5c4f45d9bee836680107ac851846d2b Mon Sep 17 00:00:00 2001 From: Kristinita Date: Mon, 22 Aug 2022 18:34:05 +0300 Subject: [PATCH 1/2] =?UTF-8?q?fix(path):=20convert=20back-slashes=20to=20?= =?UTF-8?q?forward-slashes=20for=20Windows=20=E2=80=94=20https://stackover?= =?UTF-8?q?flow.com/a/50221144/5951529?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pelican/plugins/search/search.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pelican/plugins/search/search.py b/pelican/plugins/search/search.py index 5c2355b..90c8cf7 100644 --- a/pelican/plugins/search/search.py +++ b/pelican/plugins/search/search.py @@ -7,13 +7,14 @@ Copyright (c) Justin Mayer """ -from codecs import open -from inspect import cleandoc import logging import os.path -from shutil import which import subprocess +from codecs import open +from inspect import cleandoc +from shutil import which + from jinja2.filters import do_striptags as striptags from pelican import signals @@ -22,9 +23,10 @@ class SearchSettingsGenerator: + def __init__(self, context, settings, path, theme, output_path, *null): - self.output_path = output_path + self.output_path = output_path.replace(os.sep, '/') self.context = context self.content = settings.get("PATH") self.tpages = settings.get("TEMPLATE_PAGES") @@ -49,7 +51,8 @@ def build_search_index(self, search_settings_path): check=True, ) except subprocess.CalledProcessError as e: - raise Exception("".join(["Search plugin reported ", e.stdout, e.stderr])) + raise Exception( + "".join(["Search plugin reported ", e.stdout, e.stderr])) return output.stdout @@ -112,7 +115,8 @@ def generate_output(self, writer): # Build the search index build_log = self.build_search_index(search_settings_path) build_log = "".join(["Search plugin reported ", build_log]) - logger.error(build_log) if "error" in build_log else logger.debug(build_log) + logger.error(build_log) if "error" in build_log else logger.debug( + build_log) def get_generators(generators): From d98104bcdbeb41dcdd282c50bb5158b84c390c86 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 09:38:34 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pelican/plugins/search/search.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pelican/plugins/search/search.py b/pelican/plugins/search/search.py index 90c8cf7..bea0f0c 100644 --- a/pelican/plugins/search/search.py +++ b/pelican/plugins/search/search.py @@ -7,13 +7,12 @@ Copyright (c) Justin Mayer """ -import logging -import os.path -import subprocess - from codecs import open from inspect import cleandoc +import logging +import os.path from shutil import which +import subprocess from jinja2.filters import do_striptags as striptags @@ -23,10 +22,9 @@ class SearchSettingsGenerator: - def __init__(self, context, settings, path, theme, output_path, *null): - self.output_path = output_path.replace(os.sep, '/') + self.output_path = output_path.replace(os.sep, "/") self.context = context self.content = settings.get("PATH") self.tpages = settings.get("TEMPLATE_PAGES") @@ -51,8 +49,7 @@ def build_search_index(self, search_settings_path): check=True, ) except subprocess.CalledProcessError as e: - raise Exception( - "".join(["Search plugin reported ", e.stdout, e.stderr])) + raise Exception("".join(["Search plugin reported ", e.stdout, e.stderr])) return output.stdout @@ -115,8 +112,7 @@ def generate_output(self, writer): # Build the search index build_log = self.build_search_index(search_settings_path) build_log = "".join(["Search plugin reported ", build_log]) - logger.error(build_log) if "error" in build_log else logger.debug( - build_log) + logger.error(build_log) if "error" in build_log else logger.debug(build_log) def get_generators(generators):