@@ -121,29 +121,25 @@ func RenderIssueTitle(ctx context.Context, text string, metas map[string]string)
121121// RenderLabel renders a label
122122// locale is needed due to an import cycle with our context providing the `Tr` function
123123func RenderLabel (ctx context.Context , locale translation.Locale , label * issues_model.Label ) template.HTML {
124- var (
125- archivedCSSClass string
126- textColor = util .ContrastColor (label .Color )
127- labelScope = label .ExclusiveScope ()
128- )
129-
130- description := emoji .ReplaceAliases (template .HTMLEscapeString (label .Description ))
124+ var extraCSSClasses string
125+ textColor := util .ContrastColor (label .Color )
126+ labelScope := label .ExclusiveScope ()
127+ descriptionText := emoji .ReplaceAliases (label .Description )
131128
132129 if label .IsArchived () {
133- archivedCSSClass = "archived-label"
134- description = fmt .Sprintf ("(%s) %s" , locale .TrString ("archived" ), description )
130+ extraCSSClasses = "archived-label"
131+ descriptionText = fmt .Sprintf ("(%s) %s" , locale .TrString ("archived" ), descriptionText )
135132 }
136133
137134 if labelScope == "" {
138135 // Regular label
139- s := fmt .Sprintf ("<div class='ui label %s' style='color: %s !important; background-color: %s !important;' data-tooltip-content title='%s'>%s</div>" ,
140- archivedCSSClass , textColor , label .Color , description , RenderEmoji (ctx , label .Name ))
141- return template .HTML (s )
136+ return HTMLFormat (`<div class="ui label %s" style="color: %s !important; background-color: %s !important;" data-tooltip-content title="%s">%s</div>` ,
137+ extraCSSClasses , textColor , label .Color , descriptionText , RenderEmoji (ctx , label .Name ))
142138 }
143139
144140 // Scoped label
145- scopeText := RenderEmoji (ctx , labelScope )
146- itemText := RenderEmoji (ctx , label .Name [len (labelScope )+ 1 :])
141+ scopeHTML := RenderEmoji (ctx , labelScope )
142+ itemHTML := RenderEmoji (ctx , label .Name [len (labelScope )+ 1 :])
147143
148144 // Make scope and item background colors slightly darker and lighter respectively.
149145 // More contrast needed with higher luminance, empirically tweaked.
@@ -171,14 +167,13 @@ func RenderLabel(ctx context.Context, locale translation.Locale, label *issues_m
171167 itemColor := "#" + hex .EncodeToString (itemBytes )
172168 scopeColor := "#" + hex .EncodeToString (scopeBytes )
173169
174- s := fmt .Sprintf ("<span class='ui label %s scope-parent' data-tooltip-content title='%s'>" +
175- "<div class='ui label scope-left' style='color: %s !important; background-color: %s !important'>%s</div>" +
176- "<div class='ui label scope-right' style='color: %s !important; background-color: %s !important'>%s</div>" +
177- "</span>" ,
178- archivedCSSClass , description ,
179- textColor , scopeColor , scopeText ,
180- textColor , itemColor , itemText )
181- return template .HTML (s )
170+ return HTMLFormat (`<span class="ui label %s scope-parent" data-tooltip-content title="%s">` +
171+ `<div class="ui label scope-left" style="color: %s !important; background-color: %s !important">%s</div>` +
172+ `<div class="ui label scope-right" style="color: %s !important; background-color: %s !important">%s</div>` +
173+ `</span>` ,
174+ extraCSSClasses , descriptionText ,
175+ textColor , scopeColor , scopeHTML ,
176+ textColor , itemColor , itemHTML )
182177}
183178
184179// RenderEmoji renders html text with emoji post processors
0 commit comments