Documentation ¶
Overview ¶
Package renderer provides functions to convert various data into a cview primitive. Example objects include a Gemini response, and an error.
Rendered lines always end with \r\n, in an effort to be Window compatible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadEncoding = errors.New("unsupported encoding")
var ErrBadMediatype = errors.New("displayable mediatype is not handled in the code, implementation error")
var ErrCantDisplay = errors.New("invalid content for a page")
var ErrTimedOut = errors.New("page download timed out")
var ErrTooLarge = errors.New("page content would be too large")
var TermColor string
Terminal color information, set during display initialization by display/display.go
Functions ¶
func CanDisplay ¶
func CanDisplay(res *gemini.Response) bool
CanDisplay returns true if the response is supported by Amfora for displaying on the screen. It also doubles as a function to detect whether something can be stored in a Page struct.
func MakePage ¶
MakePage creates a formatted, rendered Page from the given network response and params. You must set the Page.Width value yourself.
func RenderANSI ¶
RenderANSI renders plain text pages containing ANSI codes. Practically, it is used for the text/x-ansi.
func RenderGemini ¶
RenderGemini converts text/gemini into a cview displayable format. It also returns a slice of link URLs.
width is the number of columns to wrap to. leftMargin is the number of blank spaces to prepend to each line.
proxied is whether the request is through the gemini:// scheme. If it's not a gemini:// page, set this to true.
func RenderPlainText ¶
RenderPlainText should be used to format plain text pages.
Types ¶
This section is empty.