From ddef307622b28bee67a22ea4181b9ca8ef2e7dbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 08:06:44 +0000 Subject: [PATCH] [chore]: Bump github.com/yuin/goldmark from 1.7.2 to 1.7.3 (#3034) --- go.mod | 2 +- go.sum | 4 +-- .../yuin/goldmark/renderer/html/html.go | 36 +++++++++---------- vendor/modules.txt | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index 0846e0375..e7ec4de3e 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( github.com/uptrace/bun/dialect/sqlitedialect v1.2.1 github.com/uptrace/bun/extra/bunotel v1.2.1 github.com/wagslane/go-password-validator v0.3.0 - github.com/yuin/goldmark v1.7.2 + github.com/yuin/goldmark v1.7.3 go.opentelemetry.io/otel v1.26.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 diff --git a/go.sum b/go.sum index 6d0bfa0c0..02cd52c1d 100644 --- a/go.sum +++ b/go.sum @@ -631,8 +631,8 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.2 h1:NjGd7lO7zrUn/A7eKwn5PEOt4ONYGqpxSEeZuduvgxc= -github.com/yuin/goldmark v1.7.2/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.3 h1:fdk0a/y60GsS4NbEd13GSIP+d8OjtTkmluY32Dy1Z/A= +github.com/yuin/goldmark v1.7.3/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround h1:gFAlklid3jyXIuZBy5Vy0dhG+F6YBgosRy4syT5CDsg= gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= diff --git a/vendor/github.com/yuin/goldmark/renderer/html/html.go b/vendor/github.com/yuin/goldmark/renderer/html/html.go index b1da368e0..f9521d0fa 100644 --- a/vendor/github.com/yuin/goldmark/renderer/html/html.go +++ b/vendor/github.com/yuin/goldmark/renderer/html/html.go @@ -680,7 +680,7 @@ func (r *Renderer) renderImage(w util.BufWriter, source []byte, node ast.Node, e _, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true))) } _, _ = w.WriteString(`" alt="`) - _, _ = w.Write(nodeToHTMLText(n, source)) + r.renderAttribute(w, source, n) _ = w.WriteByte('"') if n.Title != nil { _, _ = w.WriteString(` title="`) @@ -770,6 +770,23 @@ func (r *Renderer) renderString(w util.BufWriter, source []byte, node ast.Node, return ast.WalkContinue, nil } +func (r *Renderer) renderAttribute(w util.BufWriter, source []byte, n ast.Node) { + for c := n.FirstChild(); c != nil; c = c.NextSibling() { + if s, ok := c.(*ast.String); ok { + _, _ = r.renderString(w, source, s, true) + } else if t, ok := c.(*ast.String); ok { + _, _ = r.renderText(w, source, t, true) + } else if !c.HasChildren() { + r.Writer.Write(w, c.Text(source)) + if t, ok := c.(*ast.Text); ok && t.SoftLineBreak() { + w.WriteByte('\n') + } + } else { + r.renderAttribute(w, source, c) + } + } +} + var dataPrefix = []byte("data-") // RenderAttributes renders given node's attributes. @@ -1007,20 +1024,3 @@ func IsDangerousURL(url []byte) bool { return hasPrefix(url, bJs) || hasPrefix(url, bVb) || hasPrefix(url, bFile) || hasPrefix(url, bData) } - -func nodeToHTMLText(n ast.Node, source []byte) []byte { - var buf bytes.Buffer - for c := n.FirstChild(); c != nil; c = c.NextSibling() { - if s, ok := c.(*ast.String); ok && s.IsCode() { - buf.Write(s.Text(source)) - } else if !c.HasChildren() { - buf.Write(util.EscapeHTML(c.Text(source))) - if t, ok := c.(*ast.Text); ok && t.SoftLineBreak() { - buf.WriteByte('\n') - } - } else { - buf.Write(nodeToHTMLText(c, source)) - } - } - return buf.Bytes() -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 1ede93c2c..ec3e97e0d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -938,7 +938,7 @@ github.com/vmihailenco/tagparser/v2/internal/parser # github.com/wagslane/go-password-validator v0.3.0 ## explicit; go 1.16 github.com/wagslane/go-password-validator -# github.com/yuin/goldmark v1.7.2 +# github.com/yuin/goldmark v1.7.3 ## explicit; go 1.19 github.com/yuin/goldmark github.com/yuin/goldmark/ast