package mycocontext
import "git.sr.ht/~bouncepaw/mycomarkup/v5/mycocontext"
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
Functions ¶
func ContextFromBuffer ¶
ContextFromBuffer returns the context for the given input.
func ContextFromBytes ¶
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) Input ¶
Input returns the pointer to the input buffer.
func (Context) Options ¶
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 ¶
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 ¶
WithOptions returns a copy of the given copy of the given context but with different options.
Source Files ¶
implementation.go mycocontext.go
- Version
- v5.6.0 (latest)
- Published
- Nov 29, 2023
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 9 hours ago –
Tools for package owners.