Support styled prefix/suffix in ParagraphElement

This commit is contained in:
Christian Muehlhaeuser
2019-12-13 03:00:45 +01:00
parent 7c15f8780e
commit 75c1852f53
+5 -3
View File
@@ -23,7 +23,8 @@ func (e *ParagraphElement) Render(w io.Writer, ctx RenderContext) error {
}
bs.Push(be)
renderText(w, bs.Current().Style, rules.Prefix)
renderText(w, bs.Parent().Style, rules.Prefix)
renderText(w, bs.Current().Style, rules.StyledPrefix)
return nil
}
@@ -33,8 +34,6 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
keepNewlines := false
renderText(bs.Current().Block, rules, rules.Suffix)
mw := NewMarginWriter(ctx, w, rules)
if len(strings.TrimSpace(bs.Current().Block.String())) > 0 {
flow := reflow.NewReflow(int(bs.Width(ctx)))
@@ -49,6 +48,9 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
_, _ = mw.Write([]byte("\n"))
}
renderText(w, bs.Current().Style, rules.StyledSuffix)
renderText(w, bs.Parent().Style, rules.Suffix)
bs.Current().Block.Reset()
bs.Pop()
return nil