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
+6 -9
View File
@@ -29,17 +29,14 @@ func (e *ListElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) error
func (e *ListElement) Finish(w io.Writer, node *bf.Node, tr *TermRenderer) error {
var indent uint
var margin uint
var suffix string
rules := tr.blockStack.Current().Style
if rules != nil {
if rules.Indent != nil {
indent = *rules.Indent
}
if rules.Margin != nil {
margin = *rules.Margin
}
suffix = rules.Suffix
if rules.Indent != nil {
indent = *rules.Indent
}
if rules.Margin != nil {
margin = *rules.Margin
}
suffix := rules.Suffix
renderText(tr.blockStack.Current().Block, rules, suffix)
pw := &PaddingWriter{