From 9d575a1e27f6f08e8e933855a6adda0d193015d1 Mon Sep 17 00:00:00 2001 From: Xavier Coulon Date: Fri, 20 May 2022 16:58:15 +0200 Subject: [PATCH] chore(renderer): upgrade github.com/alecthomas/chroma to v0.10.0 apply changes in rendering (extra divs for line rendering) Signed-off-by: Xavier Coulon --- go.mod | 2 +- go.sum | 22 ++-------- .../sgml/html5/delimited_block_source_test.go | 41 ++++++++++--------- pkg/renderer/sgml/html5/paragraph_test.go | 2 +- .../xhtml5/delimited_block_source_test.go | 31 +++++++------- pkg/renderer/sgml/xhtml5/paragraph_test.go | 2 +- 6 files changed, 44 insertions(+), 56 deletions(-) diff --git a/go.mod b/go.mod index 282b9f57..0bd1ba23 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bytesparadise/libasciidoc go 1.11 require ( - github.com/alecthomas/chroma v0.7.1 + github.com/alecthomas/chroma v0.10.0 github.com/davecgh/go-spew v1.1.1 github.com/google/go-cmp v0.5.5 github.com/kr/text v0.2.0 // indirect diff --git a/go.sum b/go.sum index 39b199ea..fe67e0b4 100644 --- a/go.sum +++ b/go.sum @@ -14,15 +14,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= -github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= -github.com/alecthomas/chroma v0.7.1 h1:G1i02OhUbRi2nJxcNkwJaY/J1gHXj9tt72qN6ZouLFQ= -github.com/alecthomas/chroma v0.7.1/go.mod h1:gHw09mkX1Qp80JlYbmN9L3+4R5o6DJJ3GRShh+AICNc= -github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo= -github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= -github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI= -github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= -github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= +github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -44,12 +37,10 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= -github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg= -github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E= +github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flw-cn/go-spew v1.1.2-0.20200624141737-10fccbfd0b23 h1:hcH6hdfuN3oU94k8k6HYHuc1TBUpWEtZ9V/TtxmNlKM= github.com/flw-cn/go-spew v1.1.2-0.20200624141737-10fccbfd0b23/go.mod h1:f5Lwu6V+lQV39V4TFEDGt+t0gOZunbo+MKa0nBOX5+U= @@ -145,8 +136,6 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -201,8 +190,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= @@ -299,7 +286,6 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/pkg/renderer/sgml/html5/delimited_block_source_test.go b/pkg/renderer/sgml/html5/delimited_block_source_test.go index 8d304795..fb7084d1 100644 --- a/pkg/renderer/sgml/html5/delimited_block_source_test.go +++ b/pkg/renderer/sgml/html5/delimited_block_source_test.go @@ -151,10 +151,11 @@ printf("Hello world!\n"); // <1> ` expected := `
-
#include <stdio.h>
+
#include <stdio.h>
 
-printf("Hello world!\n"); // (1)
-<a>link</a>
+printf("Hello world!\n"); // +(1) +<a>link</a>
@@ -309,9 +310,9 @@ type Foo struct{ ----` expected := `
-
type Foo struct{
-    Field string
-}
+
type Foo struct{
+    Field string
+}
` @@ -370,9 +371,9 @@ type Foo struct{ ----` expected := `
-
type Foo struct{
-    Field string
-}
+
type Foo struct{
+    Field string
+}
` @@ -392,9 +393,9 @@ type Foo struct{ ----` expected := `
-
1type Foo struct{
-2    Field string
-3}
+
1type Foo struct{
+2    Field string
+3}
` // the pygment.py sets the line number class to `tok-ln` but here we expect `tok-ln` @@ -415,9 +416,9 @@ type Foo struct{ ----` expected := `
-
1type Foo struct{
-2    Field string
-3}
+
1type Foo struct{
+2    Field string
+3}
` // the pygment.py sets the line number class to `tok-ln` but here we expect `tok-ln` @@ -436,7 +437,7 @@ const Cookie = "cookie" ----` expected := `
-
const Cookie = "cookie"
+
const Cookie = "cookie"
` @@ -454,7 +455,7 @@ const Cookie = "cookie" ----` expected := `
-
+
` @@ -472,7 +473,7 @@ Copyright (C) ----` expected := `
-
Copyright (C)
+
Copyright (C)
` @@ -511,7 +512,7 @@ Copyright (C) "```\n" expected := `
-
+
` @@ -529,7 +530,7 @@ Copyright (C) "```\n" expected := `
-
Copyright (C)
+
Copyright (C)
` diff --git a/pkg/renderer/sgml/html5/paragraph_test.go b/pkg/renderer/sgml/html5/paragraph_test.go index ac02cf5c..36a588e5 100644 --- a/pkg/renderer/sgml/html5/paragraph_test.go +++ b/pkg/renderer/sgml/html5/paragraph_test.go @@ -699,7 +699,7 @@ int main(int argc, char **argv); ` expected := `
-
int main(int argc, char **argv);
+
int main(int argc, char **argv);
` diff --git a/pkg/renderer/sgml/xhtml5/delimited_block_source_test.go b/pkg/renderer/sgml/xhtml5/delimited_block_source_test.go index a97fc011..ff35c320 100644 --- a/pkg/renderer/sgml/xhtml5/delimited_block_source_test.go +++ b/pkg/renderer/sgml/xhtml5/delimited_block_source_test.go @@ -151,10 +151,11 @@ printf("Hello world!\n"); // <1> ` expected := `
-
#include <stdio.h>
+
#include <stdio.h>
 
-printf("Hello world!\n"); // (1)
-<a>link</a>
+printf("Hello world!\n"); // +(1) +<a>link</a>
@@ -252,9 +253,9 @@ type Foo struct{ ----` expected := `
-
type Foo struct{
-    Field string
-}
+
type Foo struct{
+    Field string
+}
` @@ -313,9 +314,9 @@ type Foo struct{ ----` expected := `
-
type Foo struct{
-    Field string
-}
+
type Foo struct{
+    Field string
+}
` @@ -335,9 +336,9 @@ type Foo struct{ ----` expected := `
-
1type Foo struct{
-2    Field string
-3}
+
1type Foo struct{
+2    Field string
+3}
` // the pygment.py sets the line number class to `tok-ln` but here we expect `tok-ln` @@ -358,9 +359,9 @@ type Foo struct{ ----` expected := `
-
1type Foo struct{
-2    Field string
-3}
+
1type Foo struct{
+2    Field string
+3}
` // the pygment.py sets the line number class to `tok-ln` but here we expect `tok-ln` diff --git a/pkg/renderer/sgml/xhtml5/paragraph_test.go b/pkg/renderer/sgml/xhtml5/paragraph_test.go index 092d059b..a49b6676 100644 --- a/pkg/renderer/sgml/xhtml5/paragraph_test.go +++ b/pkg/renderer/sgml/xhtml5/paragraph_test.go @@ -521,7 +521,7 @@ int main(int argc, char **argv); ` expected := `
-
int main(int argc, char **argv);
+
int main(int argc, char **argv);
`