internal

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package internal is used for internal option configuration.

Index

Constants

This section is empty.

Variables

View Source
var CalFormatterISO = CalFormatter{
	Date:     "2006-01-02",
	DateTime: "2006-01-02 15:04",
	Location: time.UTC,
}

CalFormatterISO is the default formatter for dates and times based on the recommended ISO 8601 formatting.

Functions

func WithOptions

func WithOptions(ctx context.Context, opts *Opts) context.Context

WithOptions prepares the context with the options to use.

Types

type CalFormatter

type CalFormatter struct {
	Date     string // Golang date format for dates, e.g. `02/01/2006`
	Location *time.Location
	DateTime string // Date-time format
}

CalFormatter defines a simple date and datetime formatter

type Opts

type Opts struct {
	// Locale is the language code to use for rendering.
	Locale i18n.Code
	Logo *org.Image
	// Notes to add to the document footer instead of the notes included
	// in the envelope.
	Notes string
	// NumFormatter is used to format numbers.
	NumFormatter *num.Formatter
	// CalFormatter is used to format calendar dates and times.
	CalFormatter *CalFormatter
	// EmbedStylesheets when try ensures that all the stylesheet files
	// are contained inside the HTML output. This is useful for PDF
	// output or to avoid additional requests.
	EmbedStylesheets bool
}

Opts defines configuration options used internally with the current document. Putting this amount of information inside a context is normally an anti-pattern in Go, but saves a huge amount of effort when writing components.

func Options

func Options(ctx context.Context) *Opts

Options provides the current options in the context.

Jump to

Keyboard shortcuts

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