mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 06:39:40 +01:00
Merge pull request 'Don't use <br />
in alert block (#29650)' (#2741) from algernon/forgejo:gitea/port/29650-dont-use-br-in-alert-block into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2741 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
commit
a631e5c249
1 changed files with 5 additions and 7 deletions
|
@ -71,6 +71,7 @@ func (g *GitHubCalloutTransformer) Transform(node *ast.Document, reader text.Rea
|
||||||
v.SetAttributeString("class", []byte("gt-py-3 attention attention-"+attentionType))
|
v.SetAttributeString("class", []byte("gt-py-3 attention attention-"+attentionType))
|
||||||
|
|
||||||
// create an emphasis to make it bold
|
// create an emphasis to make it bold
|
||||||
|
attentionParagraph := ast.NewParagraph()
|
||||||
emphasis := ast.NewEmphasis(2)
|
emphasis := ast.NewEmphasis(2)
|
||||||
emphasis.SetAttributeString("class", []byte("attention-"+attentionType))
|
emphasis.SetAttributeString("class", []byte("attention-"+attentionType))
|
||||||
firstParagraph.InsertBefore(firstParagraph, firstTextNode, emphasis)
|
firstParagraph.InsertBefore(firstParagraph, firstTextNode, emphasis)
|
||||||
|
@ -78,14 +79,11 @@ func (g *GitHubCalloutTransformer) Transform(node *ast.Document, reader text.Rea
|
||||||
// capitalize first letter
|
// capitalize first letter
|
||||||
attentionText := ast.NewString([]byte(strings.ToUpper(string(attentionType[0])) + attentionType[1:]))
|
attentionText := ast.NewString([]byte(strings.ToUpper(string(attentionType[0])) + attentionType[1:]))
|
||||||
|
|
||||||
// replace the ![TYPE] with icon+Type
|
// replace the ![TYPE] with a dedicated paragraph of icon+Type
|
||||||
emphasis.AppendChild(emphasis, attentionText)
|
emphasis.AppendChild(emphasis, attentionText)
|
||||||
for i := 0; i < 2; i++ {
|
attentionParagraph.AppendChild(attentionParagraph, NewAttention(attentionType))
|
||||||
lineBreak := ast.NewText()
|
attentionParagraph.AppendChild(attentionParagraph, emphasis)
|
||||||
lineBreak.SetSoftLineBreak(true)
|
firstParagraph.Parent().InsertBefore(firstParagraph.Parent(), firstParagraph, attentionParagraph)
|
||||||
firstParagraph.InsertAfter(firstParagraph, emphasis, lineBreak)
|
|
||||||
}
|
|
||||||
firstParagraph.InsertBefore(firstParagraph, emphasis, NewAttention(attentionType))
|
|
||||||
firstParagraph.RemoveChild(firstParagraph, firstTextNode)
|
firstParagraph.RemoveChild(firstParagraph, firstTextNode)
|
||||||
firstParagraph.RemoveChild(firstParagraph, secondTextNode)
|
firstParagraph.RemoveChild(firstParagraph, secondTextNode)
|
||||||
firstParagraph.RemoveChild(firstParagraph, thirdTextNode)
|
firstParagraph.RemoveChild(firstParagraph, thirdTextNode)
|
||||||
|
|
Loading…
Reference in a new issue