diff --git a/go.mod b/go.mod index 055afaf9..095f006e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/BurntSushi/toml v0.3.1 github.com/PuerkitoBio/purell v1.1.1 github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect - github.com/alecthomas/chroma v0.8.1 + github.com/alecthomas/chroma v0.8.2 github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1 // indirect github.com/armon/go-radix v1.0.0 github.com/aws/aws-sdk-go v1.35.0 @@ -14,6 +14,7 @@ require ( github.com/bep/golibsass v0.7.0 github.com/bep/tmc v0.5.1 github.com/disintegration/gift v1.2.1 + github.com/dlclark/regexp2 v1.4.0 // indirect github.com/dustin/go-humanize v1.0.0 github.com/evanw/esbuild v0.8.11 github.com/fortytw2/leaktest v1.3.0 diff --git a/go.sum b/go.sum index 20c2f9b8..0a950535 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,8 @@ github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkK 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.2-0.20200305040604-4f3623dce67a/go.mod h1:fv5SzZPFJbwp2NXJWpFIX7DZS4HgV1K4ew4Pc2OZD9s= -github.com/alecthomas/chroma v0.8.1 h1:ym20sbvyC6RXz45u4qDglcgr8E313oPROshcuCHqiEE= -github.com/alecthomas/chroma v0.8.1/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= +github.com/alecthomas/chroma v0.8.2 h1:x3zkuE2lUk/RIekyAJ3XRqSCP4zwWDfcw/YJCuCAACg= +github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= 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.1.17-0.20190424132513-439c674f7ae0/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI= @@ -127,6 +127,8 @@ 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.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/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/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= diff --git a/markup/highlight/highlight_test.go b/markup/highlight/highlight_test.go index f5992a51..228d5e8c 100644 --- a/markup/highlight/highlight_test.go +++ b/markup/highlight/highlight_test.go @@ -87,9 +87,9 @@ User-Agent: foo h := New(cfg) result, _ := h.Highlight(lines, "bash", "") - c.Assert(result, qt.Contains, "2\n") + // From Chroma v0.8.2 this is linkable: https://github.com/alecthomas/chroma/commit/ab61726cdb54d5a98b6efe7ed76af6aa0698ab4a + c.Assert(result, qt.Contains, "2\n") result, _ = h.Highlight(lines, "bash", "lineanchors=test") - c.Assert(result, qt.Contains, "2\n") result, _ = h.Highlight(lines, "bash", "anchorlinenos=false,hl_lines=2") c.Assert(result, qt.Not(qt.Contains), "id=\"2\"") }) diff --git a/tpl/internal/go_templates/htmltemplate/testdata/file1.tmpl b/tpl/internal/go_templates/htmltemplate/testdata/file1.tmpl new file mode 100644 index 00000000..febf9d9f --- /dev/null +++ b/tpl/internal/go_templates/htmltemplate/testdata/file1.tmpl @@ -0,0 +1,2 @@ +{{define "x"}}TEXT{{end}} +{{define "dotV"}}{{.V}}{{end}} diff --git a/tpl/internal/go_templates/htmltemplate/testdata/file2.tmpl b/tpl/internal/go_templates/htmltemplate/testdata/file2.tmpl new file mode 100644 index 00000000..39bf6fb9 --- /dev/null +++ b/tpl/internal/go_templates/htmltemplate/testdata/file2.tmpl @@ -0,0 +1,2 @@ +{{define "dot"}}{{.}}{{end}} +{{define "nested"}}{{template "dot" .}}{{end}} diff --git a/tpl/internal/go_templates/htmltemplate/testdata/fs.zip b/tpl/internal/go_templates/htmltemplate/testdata/fs.zip new file mode 100644 index 00000000..8581313a Binary files /dev/null and b/tpl/internal/go_templates/htmltemplate/testdata/fs.zip differ diff --git a/tpl/internal/go_templates/htmltemplate/testdata/tmpl1.tmpl b/tpl/internal/go_templates/htmltemplate/testdata/tmpl1.tmpl new file mode 100644 index 00000000..b72b3a34 --- /dev/null +++ b/tpl/internal/go_templates/htmltemplate/testdata/tmpl1.tmpl @@ -0,0 +1,3 @@ +template1 +{{define "x"}}x{{end}} +{{template "y"}} diff --git a/tpl/internal/go_templates/htmltemplate/testdata/tmpl2.tmpl b/tpl/internal/go_templates/htmltemplate/testdata/tmpl2.tmpl new file mode 100644 index 00000000..16beba6e --- /dev/null +++ b/tpl/internal/go_templates/htmltemplate/testdata/tmpl2.tmpl @@ -0,0 +1,3 @@ +template2 +{{define "y"}}y{{end}} +{{template "x"}}