From da5f5078e1d574c35cfc784194f172de68feaedd Mon Sep 17 00:00:00 2001 From: Septatrix <24257556+Septatrix@users.noreply.github.com> Date: Sun, 8 Mar 2020 17:20:15 +0100 Subject: [PATCH] Check existence of dark highlighter --- .vscode/settings.json | 3 +++ sphinx/builders/html/__init__.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..6089b5e8e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": ".venv/bin/python3" +} diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py index 5105c4e2c..1ff529ca1 100644 --- a/sphinx/builders/html/__init__.py +++ b/sphinx/builders/html/__init__.py @@ -740,8 +740,9 @@ class StandaloneHTMLBuilder(Builder): with open(path.join(self.outdir, '_static', 'pygments.css'), 'w') as f: f.write(self.highlighter.get_stylesheet()) - with open(path.join(self.outdir, '_static', 'pygments_dark.css'), 'w') as f: - f.write(self.dark_highlighter.get_stylesheet()) + if self.dark_hightlighter: + with open(path.join(self.outdir, '_static', 'pygments_dark.css'), 'w') as f: + f.write(self.dark_highlighter.get_stylesheet()) def create_pygments_aux_style_files(self) -> None: """create a style file for pygments."""