Use renderText even without an active style

This commit is contained in:
Christian Muehlhaeuser
2019-12-04 05:47:57 +01:00
parent afd83210ea
commit b518696b44
3 changed files with 9 additions and 11 deletions
+6 -9
View File
@@ -68,17 +68,14 @@ func (e *BaseElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) error
renderText(w, tr.blockStyle.Current(), e.Suffix)
}()
rules := cascadeStyles(tr.blockStyle, tr.style[e.Style])
if rules == nil {
_, _ = w.Write([]byte(e.Token))
return nil
rules := tr.blockStyle.With(tr.style[e.Style])
if rules != nil {
renderText(w, rules, rules.Prefix)
defer func() {
renderText(w, rules, rules.Suffix)
}()
}
renderText(w, rules, rules.Prefix)
defer func() {
renderText(w, rules, rules.Suffix)
}()
renderText(w, rules, e.Token)
return nil
}