configuration

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: Apache-2.0 Imports: 3 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// LastUpdatedFormat key to the time format for the `last updated` document attribute
	LastUpdatedFormat string = "2006-01-02 15:04:05 -0700"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Filename            string
	AttributeOverrides  map[string]string
	LastUpdated         time.Time
	IncludeHeaderFooter bool
	CSS                 string
	// contains filtered or unexported fields
}

Configuration the configuration used when rendering a document

func NewConfiguration

func NewConfiguration(settings ...Setting) Configuration

NewConfiguration returns a new configuration

func (Configuration) Clone

func (c Configuration) Clone() Configuration

Clone return a clone of the current configuration

func (Configuration) MacroTemplate

func (c Configuration) MacroTemplate(name string) (MacroTemplate, error)

MacroTemplate finds and returns a user macro function by specified name.

type MacroTemplate

type MacroTemplate interface {
	Execute(wr io.Writer, data interface{}) error
}

MacroTemplate an interface of template for user macro.

type Setting

type Setting func(config *Configuration)

Setting a setting to customize the configuration used during parsing and rendering of a document

func WithAttribute added in v0.4.0

func WithAttribute(key, value string) Setting

WithAttribute function to set an attribute as if it was passed as an argument in the CLI

func WithAttributes

func WithAttributes(attrs map[string]string) Setting

WithAttributes function to set the `attribute overrides`

func WithCSS

func WithCSS(href string) Setting

WithCSS function to set the `css` setting in the config

func WithFilename

func WithFilename(filename string) Setting

WithFilename function to set the `filename` setting in the config

func WithHeaderFooter

func WithHeaderFooter(value bool) Setting

WithHeaderFooter function to set the `include header/footer` setting in the config

func WithLastUpdated

func WithLastUpdated(value time.Time) Setting

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

func WithMacroTemplate

func WithMacroTemplate(name string, t MacroTemplate) Setting

WithMacroTemplate defines the given template to a user macro with the given name

Jump to

Keyboard shortcuts

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