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