mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-01 06:36:43 -04:00
Add BlockStack.Len() for convenience
This commit is contained in:
@@ -11,6 +11,10 @@ type BlockElement struct {
|
||||
|
||||
type BlockStack []BlockElement
|
||||
|
||||
func (s *BlockStack) Len() int {
|
||||
return len(*s)
|
||||
}
|
||||
|
||||
func (s *BlockStack) Push(e BlockElement) {
|
||||
*s = append(*s, e)
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func (tr *TermRenderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf
|
||||
|
||||
e := tr.NewElement(node)
|
||||
if entering {
|
||||
if len(*bs) > 0 {
|
||||
if bs.Len() > 0 {
|
||||
writeTo = io.Writer(bs.Current().Block)
|
||||
}
|
||||
_, _ = writeTo.Write([]byte(e.Entering))
|
||||
@@ -113,7 +113,7 @@ func (tr *TermRenderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if len(*bs) > 0 {
|
||||
if bs.Len() > 0 {
|
||||
writeTo = io.Writer(bs.Parent().Block)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user