mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
deps: Update github.com/alecthomas/chroma v0.9.4 => v0.10.0
This commit is contained in:
parent
9563c7d13b
commit
ea54a99ca5
7 changed files with 58 additions and 20 deletions
|
@ -167,6 +167,12 @@
|
|||
"bibtex"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Bicep",
|
||||
"Aliases": [
|
||||
"bicep"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "BlitzBasic",
|
||||
"Aliases": [
|
||||
|
@ -971,6 +977,19 @@
|
|||
"onesenterprise"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OpenEdge ABL",
|
||||
"Aliases": [
|
||||
"abl",
|
||||
"cls",
|
||||
"i",
|
||||
"openedge",
|
||||
"openedgeabl",
|
||||
"p",
|
||||
"progress",
|
||||
"w"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OpenSCAD",
|
||||
"Aliases": [
|
||||
|
@ -1049,6 +1068,13 @@
|
|||
"txt"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Plutus Core",
|
||||
"Aliases": [
|
||||
"plc",
|
||||
"plutus-core"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Pony",
|
||||
"Aliases": [
|
||||
|
@ -1608,8 +1634,11 @@
|
|||
{
|
||||
"Name": "XML",
|
||||
"Aliases": [
|
||||
"csproj",
|
||||
"fsproj",
|
||||
"rss",
|
||||
"svg",
|
||||
"vcxproj",
|
||||
"wsdl",
|
||||
"wsf",
|
||||
"xml",
|
||||
|
@ -1638,6 +1667,12 @@
|
|||
"yang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Zed",
|
||||
"Aliases": [
|
||||
"zed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "Zig",
|
||||
"Aliases": [
|
||||
|
@ -1870,7 +1905,9 @@
|
|||
"type": "application/javascript",
|
||||
"string": "application/javascript",
|
||||
"suffixes": [
|
||||
"js"
|
||||
"js",
|
||||
"jsm",
|
||||
"mjs"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ require (
|
|||
github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69
|
||||
github.com/PuerkitoBio/purell v1.1.1
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/alecthomas/chroma v0.9.4
|
||||
github.com/alecthomas/chroma v0.10.0
|
||||
github.com/armon/go-radix v1.0.0
|
||||
github.com/aws/aws-sdk-go v1.41.14
|
||||
github.com/bep/debounce v1.2.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -113,6 +113,8 @@ github.com/alecthomas/chroma v0.7.2-0.20200305040604-4f3623dce67a/go.mod h1:fv5S
|
|||
github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
|
||||
github.com/alecthomas/chroma v0.9.4 h1:YL7sOAE3p8HS96T9km7RgvmsZIctqbK1qJ0b7hzed44=
|
||||
github.com/alecthomas/chroma v0.9.4/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
|
||||
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/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=
|
||||
github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI=
|
||||
|
|
|
@ -89,13 +89,13 @@ func TestShortcodeHighlight(t *testing.T) {
|
|||
`{{< highlight java >}}
|
||||
void do();
|
||||
{{< /highlight >}}`,
|
||||
`(?s)<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java"`,
|
||||
`(?s)<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java"`,
|
||||
},
|
||||
{
|
||||
`{{< highlight java "style=friendly" >}}
|
||||
void do();
|
||||
{{< /highlight >}}`,
|
||||
`(?s)<div class="highlight"><pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java">`,
|
||||
`(?s)<div class="highlight"><pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java">`,
|
||||
},
|
||||
} {
|
||||
|
||||
|
|
|
@ -1914,8 +1914,8 @@ Link with URL as text
|
|||
b.AssertFileContent("public/page/index.html",
|
||||
`<nav id="TableOfContents">
|
||||
<li><a href="#shortcode-t-short-in-header">Shortcode T-SHORT in header</a></li>
|
||||
<code class="language-bash" data-lang="bash"><span class="hl">SHORT
|
||||
<code class="language-bash" data-lang="bash"><span class="hl">MARKDOWN
|
||||
<code class="language-bash" data-lang="bash"><span class="line hl"><span class="cl">SHORT
|
||||
<code class="language-bash" data-lang="bash"><span class="line hl"><span class="cl">MARKDOWN
|
||||
<p><a href="https://google.com">https://google.com</a></p>
|
||||
`)
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ description
|
|||
c.Assert(got, qt.Contains, `<h2 id="神真美好-2">神真美好</h2>`, qt.Commentf(got))
|
||||
|
||||
// Code fences
|
||||
c.Assert(got, qt.Contains, "<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-bash\" data-lang=\"bash\">LINE1\n</code></pre></div>")
|
||||
c.Assert(got, qt.Contains, "<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\">LINE1\n</span></span></code></pre></div>")
|
||||
c.Assert(got, qt.Contains, "Code Fences No Lexer</h2>\n<pre tabindex=\"0\"><code class=\"language-moo\" data-lang=\"moo\">LINE1\n</code></pre>")
|
||||
|
||||
// Extensions
|
||||
|
@ -263,8 +263,10 @@ func TestConvertAttributes(t *testing.T) {
|
|||
conf.Highlight.CodeFences = true
|
||||
},
|
||||
"```bash {linenos=table .myclass id=\"myid\"}\necho 'foo';\n````\n{ .adfadf }",
|
||||
[]string{"div class=\"highlight myclass\" id=\"myid\"><div s",
|
||||
"table style"},
|
||||
[]string{
|
||||
"div class=\"highlight myclass\" id=\"myid\"><div s",
|
||||
"table style",
|
||||
},
|
||||
},
|
||||
{
|
||||
"Paragraph",
|
||||
|
@ -326,10 +328,8 @@ func TestConvertAttributes(t *testing.T) {
|
|||
for _, s := range cast.ToStringSlice(test.expect) {
|
||||
c.Assert(got, qt.Contains, s)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestConvertIssues(t *testing.T) {
|
||||
|
@ -389,8 +389,7 @@ LINE5
|
|||
|
||||
result := convertForConfig(c, cfg, `echo "Hugo Rocks!"`, "bash")
|
||||
// TODO(bep) there is a whitespace mismatch (\n) between this and the highlight template func.
|
||||
c.Assert(result, qt.Equals, `<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="nb">echo</span> <span class="s2">"Hugo Rocks!"</span>
|
||||
</code></pre></div>`)
|
||||
c.Assert(result, qt.Equals, "<div class=\"highlight\"><pre tabindex=\"0\" class=\"chroma\"><code class=\"language-bash\" data-lang=\"bash\"><span class=\"line\"><span class=\"cl\"><span class=\"nb\">echo</span> <span class=\"s2\">"Hugo Rocks!"</span>\n</span></span></code></pre></div>")
|
||||
result = convertForConfig(c, cfg, `echo "Hugo Rocks!"`, "unknown")
|
||||
c.Assert(result, qt.Equals, "<pre tabindex=\"0\"><code class=\"language-unknown\" data-lang=\"unknown\">echo "Hugo Rocks!"\n</code></pre>")
|
||||
})
|
||||
|
@ -404,7 +403,7 @@ LINE5
|
|||
c.Assert(result, qt.Contains, "<span class=\"hl\"><span class=\"lnt\">4")
|
||||
|
||||
result = convertForConfig(c, cfg, lines, "bash {linenos=inline,hl_lines=[2]}")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n</span>")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span></span>")
|
||||
c.Assert(result, qt.Not(qt.Contains), "<table")
|
||||
|
||||
result = convertForConfig(c, cfg, lines, "bash {linenos=true,hl_lines=[2]}")
|
||||
|
@ -431,7 +430,7 @@ LINE5
|
|||
cfg.LineNumbersInTable = false
|
||||
|
||||
result := convertForConfig(c, cfg, lines, "bash")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span>")
|
||||
result = convertForConfig(c, cfg, lines, "bash {linenos=table}")
|
||||
c.Assert(result, qt.Contains, "<span class=\"lnt\">1\n</span>")
|
||||
})
|
||||
|
@ -454,6 +453,6 @@ LINE5
|
|||
cfg.LineNumbersInTable = false
|
||||
|
||||
result := convertForConfig(c, cfg, lines, "")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span></span>")
|
||||
})
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ User-Agent: foo
|
|||
h := New(cfg)
|
||||
|
||||
result, _ := h.Highlight(`echo "Hugo Rocks!"`, "bash", "")
|
||||
c.Assert(result, qt.Equals, `<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="nb">echo</span> <span class="s2">"Hugo Rocks!"</span></code></pre></div>`)
|
||||
c.Assert(result, qt.Equals, `<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s2">"Hugo Rocks!"</span></span></span></code></pre></div>`)
|
||||
result, _ = h.Highlight(`echo "Hugo Rocks!"`, "unknown", "")
|
||||
c.Assert(result, qt.Equals, `<pre tabindex="0"><code class="language-unknown" data-lang="unknown">echo "Hugo Rocks!"</code></pre>`)
|
||||
})
|
||||
|
@ -58,7 +58,7 @@ User-Agent: foo
|
|||
c.Assert(result, qt.Contains, "<span class=\"hl\"><span class=\"lnt\">4")
|
||||
|
||||
result, _ = h.Highlight(lines, "bash", "linenos=inline,hl_lines=2")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n</span>")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span></span>")
|
||||
c.Assert(result, qt.Not(qt.Contains), "<table")
|
||||
|
||||
result, _ = h.Highlight(lines, "bash", "linenos=true,hl_lines=2")
|
||||
|
@ -101,7 +101,7 @@ User-Agent: foo
|
|||
h := New(cfg)
|
||||
|
||||
result, _ := h.Highlight(lines, "bash", "")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<")
|
||||
c.Assert(result, qt.Contains, "<span class=\"cl\">LINE2\n</span></span>")
|
||||
result, _ = h.Highlight(lines, "bash", "linenos=table")
|
||||
c.Assert(result, qt.Contains, "<span class=\"lnt\">1\n</span>")
|
||||
})
|
||||
|
@ -125,7 +125,7 @@ User-Agent: foo
|
|||
h := New(cfg)
|
||||
|
||||
result, _ := h.Highlight(lines, "", "")
|
||||
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span>LINE2\n<")
|
||||
c.Assert(result, qt.Contains, "<span class=\"cl\">LINE2\n</span></span>")
|
||||
})
|
||||
|
||||
c.Run("No language, Escape HTML string", func(c *qt.C) {
|
||||
|
|
Loading…
Reference in a new issue