From dc01b4eaf0e945b131e8f8094d1a7b6a5c873c1c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 26 Oct 2017 22:42:55 +0200 Subject: [PATCH] Use Pygments for syntax highlighting --- doc/changelog.asciidoc | 2 ++ scripts/asciidoc2html.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 796f4edb6..64ae5405c 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -37,6 +37,8 @@ Changed ~~~~~~~ - High-DPI favicons are now used when available. +- The `asciidoc2html.py` script now uses Pygments (which is already a dependency + of qutebrowser) instead of `source-highlight` for syntax highlighting. Fixed ~~~~~ diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py index aa6c82469..0055c5a42 100755 --- a/scripts/asciidoc2html.py +++ b/scripts/asciidoc2html.py @@ -89,6 +89,7 @@ class AsciiDoc: ("http://qutebrowser.org/img/cheatsheet-small.png", "qute://help/img/cheatsheet-small.png") ] + asciidoc_args = ['-a', 'source-highlighter=pygments'] for src, dst in files: src_basename = os.path.basename(src) @@ -99,7 +100,7 @@ class AsciiDoc: for orig, repl in replacements: line = line.replace(orig, repl) modified_f.write(line) - self.call(modified_src, dst) + self.call(modified_src, dst, *asciidoc_args) def _copy_images(self): """Copy image files to qutebrowser/html/doc.""" @@ -180,7 +181,8 @@ class AsciiDoc: with open(modified_src, 'w+', encoding='utf-8') as final_version: final_version.write(title + "\n\n" + header + current_lines) - asciidoc_args = ['--theme=qute', '-a toc', '-a toc-placement=manual'] + asciidoc_args = ['--theme=qute', '-a toc', '-a toc-placement=manual', + '-a', 'source-highlighter=pygments'] self.call(modified_src, dst, *asciidoc_args) def _build_website(self):