configuration

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: Apache-2.0 Imports: 5 Imported by: 7

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 // TODO: move out of Configuration?
	Attributes            types.Attributes
	LastUpdated           time.Time
	WrapInHTMLBodyElement bool // flag to include the content in an html>body element
	CSS                   []string
	BackEnd               string
	Macros                map[string]MacroTemplate
}

Configuration the configuration used when rendering a document

func NewConfiguration

func NewConfiguration(settings ...Setting) *Configuration

NewConfiguration returns a new configuration

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 string, value interface{}) 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]interface{}) Setting

WithAttributes function to set the `attribute overrides`

func WithBackEnd added in v0.5.0

func WithBackEnd(backend string) Setting

WithBackEnd sets the backend format, valid values are "html", "html5", "xhtml", "xhtml5", and "" (defaults to html5)

func WithCSS

func WithCSS(hrefs []string) Setting

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

func WithFigureCaption added in v0.7.0

func WithFigureCaption(caption string) Setting

WithFigureCaption function to set the `fogure-caption` attribute

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