Use ElementStyle as a value instead of pointer, so we can drop all the annoying nil checks

This commit is contained in:
Christian Muehlhaeuser
2019-12-05 18:05:29 +01:00
parent 556c490ac4
commit 78e36a02d0
11 changed files with 147 additions and 176 deletions
+2 -2
View File
@@ -35,8 +35,8 @@ func (e *LinkElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) error
}
if len(node.LinkData.Destination) > 0 {
style := *tr.style[Link]
pre := " "
style := tr.style[Link]
if !textRendered {
pre = ""
style.Prefix = ""
@@ -46,7 +46,7 @@ func (e *LinkElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) error
el := &BaseElement{
Token: resolveRelativeURL(tr.BaseURL, string(node.LinkData.Destination)),
Prefix: pre,
Style: &style,
Style: style,
}
err := el.Render(w, node, tr)
if err != nil {