renderer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// LastUpdatedFormat the time format for the `last updated` document attribute
	LastUpdatedFormat string = "2006/01/02 15:04:05 MST"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Document types.Document
	// contains filtered or unexported fields
}

Context is a custom implementation of the standard golang context.Context interface, which carries the types.Document which is being processed

func Wrap

func Wrap(ctx context.Context, document types.Document, options ...Option) *Context

Wrap wraps the given `ctx` context into a new context which will contain the given `document` document.

func (*Context) Deadline

func (ctx *Context) Deadline() (deadline time.Time, ok bool)

Deadline wrapper implementation of context.Context.Deadline()

func (*Context) Done

func (ctx *Context) Done() <-chan struct{}

Done wrapper implementation of context.Context.Done()

func (*Context) Err

func (ctx *Context) Err() error

Err wrapper implementation of context.Context.Err()

func (*Context) GetAndIncrementExampleBlockCounter

func (ctx *Context) GetAndIncrementExampleBlockCounter() int

GetAndIncrementExampleBlockCounter returns the current value for the example block counter after internally incrementing it.

func (*Context) GetAndIncrementImageCounter

func (ctx *Context) GetAndIncrementImageCounter() int

GetAndIncrementImageCounter returns the current value for the image counter after internally incrementing it.

func (*Context) GetAndIncrementTableCounter

func (ctx *Context) GetAndIncrementTableCounter() int

GetAndIncrementTableCounter returns the current value for the table counter after internally incrementing it.

func (*Context) GetImagesDir

func (ctx *Context) GetImagesDir() string

GetImagesDir returns the value of the `imagesdir` attribute if it was set (as a string), empty string otherwise

func (*Context) IncludeBlankLine

func (ctx *Context) IncludeBlankLine() bool

IncludeBlankLine indicates if blank lines should be rendered (default false)

func (*Context) IncludeHeaderFooter

func (ctx *Context) IncludeHeaderFooter() bool

IncludeHeaderFooter returns the value of the 'LastUpdated' Option if it was present, otherwise it returns `false`

func (*Context) LastUpdated

func (ctx *Context) LastUpdated() string

LastUpdated returns the value of the 'LastUpdated' Option if it was present, otherwise it returns the current time using the `2006/01/02 15:04:05 MST` format

func (*Context) SetIncludeBlankLine

func (ctx *Context) SetIncludeBlankLine(b bool) bool

SetIncludeBlankLine sets the rendering context to include (or not) the blank lines

func (*Context) SetWithinDelimitedBlock

func (ctx *Context) SetWithinDelimitedBlock(b bool) bool

SetWithinDelimitedBlock sets the rendering context to be within a delimited block

func (*Context) SetWithinList

func (ctx *Context) SetWithinList(w bool)

SetWithinList sets the rendering context to be within a list or a nest list

func (*Context) Value

func (ctx *Context) Value(key interface{}) interface{}

Value wrapper implementation of context.Context.Value(interface{})

func (*Context) WithinDelimitedBlock

func (ctx *Context) WithinDelimitedBlock() bool

WithinDelimitedBlock indicates if the current element to render is within a delimited block or not

func (*Context) WithinList

func (ctx *Context) WithinList() bool

WithinList indicates if the current element to render is within a list or not

type Option

type Option func(ctx *Context)

Option the options when rendering a document

func Entrypoint

func Entrypoint(entrypoint string) Option

Entrypoint function to set the `entrypoint` option in the renderer context

func IncludeHeaderFooter

func IncludeHeaderFooter(value bool) Option

IncludeHeaderFooter function to set the `include header/footer` option in the renderer context

func LastUpdated

func LastUpdated(value time.Time) Option

LastUpdated function to set the `last updated` option in the renderer context (default is `time.Now()`)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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