Documentation
¶
Overview ¶
Package mycocontext provides a context type for all things Mycomarkup. It also implements the context.Context interface, if that's your thing.
Index ¶
- func ContextFromBuffer(input *bytes.Buffer, opts options.Options) (Context, CancelFunc)
- func ContextFromBytes(input []byte, opts options.Options) (Context, CancelFunc)
- func ContextFromStringInput(input string, opts options.Options) (Context, CancelFunc)
- type CancelFunc
- type Context
- func (ctx Context) HyphaName() string
- func (ctx Context) Input() *bytes.Buffer
- func (ctx Context) Options() options.Options
- func (ctx Context) RecursionLevel() uint
- func (ctx Context) WithBuffer(buf *bytes.Buffer) Context
- func (ctx Context) WithIncrementedRecursionLevel() Context
- func (ctx Context) WithOptions(opts options.Options) Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextFromBuffer ¶ added in v5.3.0
ContextFromBuffer returns the context for the given input.
func ContextFromBytes ¶ added in v5.3.0
func ContextFromBytes(input []byte, opts options.Options) (Context, CancelFunc)
ContextFromBytes returns the context for the given input.
func ContextFromStringInput ¶
func ContextFromStringInput(input string, opts options.Options) (Context, CancelFunc)
ContextFromStringInput returns the context for the given input.
Types ¶
type CancelFunc ¶
type CancelFunc context.CancelFunc
CancelFunc is a function you call to cancel the context.
Why would you, though? It is currently unused. I doubt it works, actually.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context contains all context related to the current Mycomarkup document.
It is cheap to copy it.
func (Context) HyphaName ¶
func (ctx Context) HyphaName() string
HyphaName returns the name of the Mycomarkup document being parsed.
This method is the same as:. It is just used so much.
ctx.Options().HyphaName
func (Context) Options ¶ added in v5.3.0
Options returns Options for how to parse and render the document.
func (Context) RecursionLevel ¶
func (ctx Context) RecursionLevel() uint
RecursionLevel returns the current recursion level. The recursion level can be increased by WithIncrementedRecursionLevel.
func (Context) WithBuffer ¶ added in v5.3.0
WithBuffer returns a copy of the given context but with a different input buffer.
func (Context) WithIncrementedRecursionLevel ¶
func (ctx Context) WithIncrementedRecursionLevel() Context
WithIncrementedRecursionLevel returns a copy of the context, except it has an incremented recursion level. Use that in translcusion, and check so that it's not really high.
func (Context) WithOptions ¶ added in v5.3.0
WithOptions returns a copy of the given copy of the given context but with different options.