Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Nov 16, 2024
1 parent ebd88a5 commit d572833
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions modules/markup/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package markup

import (
"bytes"
"fmt"
"html/template"
"io"
"regexp"
"slices"
"strings"
"sync"

Expand Down Expand Up @@ -227,15 +226,16 @@ func RenderCommitMessageSubject(
ctx *RenderContext,
defaultLink, content string,
) (string, error) {
procs := commitMessageSubjectProcessors
rendered, err := renderProcessString(ctx, procs, content)
if err != nil {
return "", err
}
if defaultLink != "" {
rendered = fmt.Sprintf(`<a href="%s" class="muted">%s</a>`, template.HTMLEscapeString(defaultLink), rendered)
}
return rendered, nil
procs := slices.Clone(commitMessageSubjectProcessors)
procs = append(procs, func(ctx *RenderContext, node *html.Node) {
ch := &html.Node{Parent: node, Type: html.TextNode, Data: node.Data}
node.Type = html.ElementNode
node.Data = "a"
node.DataAtom = atom.A
node.Attr = []html.Attribute{{Key: "href", Val: defaultLink}, {Key: "class", Val: "muted"}}
node.FirstChild, node.LastChild = ch, ch
})
return renderProcessString(ctx, procs, content)
}

// RenderIssueTitle to process title on individual issue/pull page
Expand Down

0 comments on commit d572833

Please sign in to comment.