mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Move ANSIRenderer into a separate package
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package ansi
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type ItemElement struct {
|
||||
Enumeration uint
|
||||
}
|
||||
|
||||
func (e *ItemElement) Render(w io.Writer, ctx RenderContext) error {
|
||||
var el *BaseElement
|
||||
if e.Enumeration > 0 {
|
||||
el = &BaseElement{
|
||||
Style: ctx.options.Styles.Enumeration,
|
||||
Prefix: strconv.FormatInt(int64(e.Enumeration), 10),
|
||||
}
|
||||
} else {
|
||||
el = &BaseElement{
|
||||
Style: ctx.options.Styles.Item,
|
||||
}
|
||||
}
|
||||
|
||||
return el.Render(w, ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user