mycocontext

package
v5.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 3 Imported by: 5

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextFromBuffer added in v5.3.0

func ContextFromBuffer(input *bytes.Buffer, opts options.Options) (Context, CancelFunc)

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) Input

func (ctx Context) Input() *bytes.Buffer

Input returns the pointer to the input buffer.

func (Context) Options added in v5.3.0

func (ctx Context) Options() options.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 added in v5.3.0

func (ctx Context) WithBuffer(buf *bytes.Buffer) Context

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

func (ctx Context) WithOptions(opts options.Options) Context

WithOptions returns a copy of the given copy of the given context but with different options.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL