mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-05 16:37:19 -04:00
Use ElementStyle as a value instead of pointer, so we can drop all the annoying nil checks
This commit is contained in:
+8
-12
@@ -18,26 +18,22 @@ func (e *DocumentElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) e
|
||||
}
|
||||
tr.blockStack.Push(be)
|
||||
|
||||
if rules != nil {
|
||||
renderText(tr.blockStack.Current().Block, rules, rules.Prefix)
|
||||
}
|
||||
renderText(tr.blockStack.Current().Block, rules, rules.Prefix)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *DocumentElement) Finish(w io.Writer, node *bf.Node, tr *TermRenderer) error {
|
||||
var indent uint
|
||||
var margin uint
|
||||
var suffix string
|
||||
rules := tr.style[Document]
|
||||
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
|
||||
|
||||
pw := &PaddingWriter{
|
||||
Padding: uint(tr.WordWrap) - margin,
|
||||
PadFunc: func(wr io.Writer) {
|
||||
|
||||
Reference in New Issue
Block a user