Fix build with chroma 0.7.0.

This commit is contained in:
Elliott Sales de Andrade 2020-02-17 03:57:25 -05:00
parent 51771f8140
commit aa1d1ba775
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,49 @@
From 4948389ddf314fdd1ddb8bc861d53cca8e6b7b16 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 17 Feb 2020 03:46:51 -0500
Subject: [PATCH] Fix compile against chroma 0.7.0.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
commands/genchromastyles.go | 2 +-
helpers/pygments.go | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/commands/genchromastyles.go b/commands/genchromastyles.go
index a2231e56..1f82d764 100644
--- a/commands/genchromastyles.go
+++ b/commands/genchromastyles.go
@@ -68,7 +68,7 @@ func (g *genChromaStyles) generate() error {
if err != nil {
return err
}
- formatter := html.New(html.WithClasses())
+ formatter := html.New(html.WithClasses(true))
formatter.WriteCSS(os.Stdout, style)
return nil
}
diff --git a/helpers/pygments.go b/helpers/pygments.go
index 4d7631ce..f60f8d90 100644
--- a/helpers/pygments.go
+++ b/helpers/pygments.go
@@ -303,14 +303,14 @@ func (cs *ContentSpec) chromaFormatterFromOptions(pygmentsOpts map[string]string
var options = []html.Option{html.TabWidth(4)}
if pygmentsOpts["noclasses"] == "false" {
- options = append(options, html.WithClasses())
+ options = append(options, html.WithClasses(true))
}
lineNumbers := pygmentsOpts["linenos"]
if lineNumbers != "" {
- options = append(options, html.WithLineNumbers())
+ options = append(options, html.WithLineNumbers(true))
if lineNumbers != "inline" {
- options = append(options, html.LineNumbersInTable())
+ options = append(options, html.LineNumbersInTable(true))
}
}
--
2.21.1

View File

@ -26,6 +26,8 @@ URL: %{gourl}
Source0: %{gosource}
# Skip test that uses the network.
Patch0001: https://sources.debian.org/data/main/h/hugo/0.58.3-1/debian/patches/0005-skip-modules-TestClient.patch
# Not sent upstream as this code is deleted.
Patch0002: 0001-Fix-compile-against-chroma-0.7.0.patch
BuildRequires: golang(github.com/alecthomas/chroma)
BuildRequires: golang(github.com/alecthomas/chroma/formatters)
@ -125,6 +127,7 @@ BuildRequires: rubygem-asciidoctor
%goprep
%patch0001 -p1
%patch0002 -p1
# Replace blackfriday import path to avoid conflict with v2
# Depend on unversioned tdewolff/minify until Go modules are supported in Fedora
@ -180,6 +183,7 @@ install -Dp man/* -t %{buildroot}%{_mandir}/man1
%changelog
* Mon Feb 17 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.59.1-2
- Rebuilt for GHSA-jf24-p9p9-4rjh
- Fix build with chroma 0.7.0
* Fri Nov 01 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.59.1-1
- Update to latest version