Skip to content

Commit

Permalink
🚚 (template): Rename var
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Aug 12, 2023
1 parent d9bf0b8 commit 03a50a9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/template_funcs/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ var (
)

func FormatHashtags(s string) string {
hashtags := hashtagRe.FindAllString(s, -1)
if hashtags == nil {
matches := hashtagRe.FindAllString(s, -1)
if matches == nil {
return s
}

var buf bytes.Buffer
for _, hashtag := range hashtags {
prefix := string(hashtag[0])
slug := hashtag[2:]
text := hashtag[1:]
for _, match := range matches {
prefix := string(match[0])
slug := match[2:]
text := match[1:]

if prefix == "#" {
prefix = ""
slug = text
text = hashtag
text = match
}

if err := hashtagTmpl.Execute(&buf, map[string]string{
Expand All @@ -86,7 +86,7 @@ func FormatHashtags(s string) string {

s = strings.Replace(
s,
hashtag,
match,
buf.String(),
1,
)
Expand Down

0 comments on commit 03a50a9

Please sign in to comment.