Documentation
¶
Overview ¶
Package encoder provides a generic interface to encode the abstract syntax tree into some text form.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEncodings ¶
func GetEncodings() []api.EncodingEnum
GetEncodings returns all registered encodings, ordered by encoding value.
Types ¶
type CreateParameter ¶
type CreateParameter struct {
Lang string // default language
}
CreateParameter contains values that are needed to create some encoder.
type Encoder ¶
type Encoder interface {
// WriteZettel encodes a whole zettel and writes it to the Writer.
WriteZettel(io.Writer, *ast.Zettel) error
// WriteMeta encodes just the metadata.
WriteMeta(io.Writer, *meta.Meta) error
// WriteSz encodes SZ represented zettel content.
WriteSz(io.Writer, *sx.Pair) error
}
Encoder is an interface that allows to encode different parts of a zettel.
func Create ¶
func Create(enc api.EncodingEnum, params *CreateParameter) Encoder
Create builds a new encoder with the given options.
type TextEncoder ¶
type TextEncoder struct{}
TextEncoder encodes just the text and ignores any formatting.
func (*TextEncoder) WriteZettel ¶
WriteZettel writes metadata and content.
Click to show internal directories.
Click to hide internal directories.