Documentation
¶
Overview ¶
Package goblhtml provides a simple way to render HTML documents from GOBL envelopes.
Index ¶
- Variables
- func HideKeys() []string
- func Render(ctx context.Context, env *gobl.Envelope, opts ...Option) ([]byte, error)
- type Option
- func WithCalFormatter(date, timeFormat string, loc *time.Location) Option
- func WithCurrencyTemplate(val string) Option
- func WithDecimalMark(val string) Option
- func WithEmbeddedAssets() Option
- func WithHide(keys ...string) Option
- func WithLabel(label string) Option
- func WithLayout(l layout.Code) Option
- func WithLocale(locale i18n.Code) Option
- func WithLogo(logo *org.Image) Option
- func WithNegativeTemplate(val string) Option
- func WithNotes(txt string) Option
- func WithNumFormatter(nf num.Formatter) Option
- func WithSandbox(sandbox bool) Option
- func WithThousandsSeparator(val string) Option
- func WithVoid(void bool) Option
- func WithWatermark(watermark string) Option
- type Warning
Constants ¶
This section is empty.
Variables ¶
var EnableAdjustmentMode = func(o *internal.Opts) { o.AdjustmentMode = true }
EnableAdjustmentMode indicates that invoice types credit-note and debit-note or similar should be rendered as adjustments to the original invoice, as required in certain jurisdictions. By default, this mode is disabled.
Functions ¶
Types ¶
type Option ¶
Option defines a configuration option to use for rendering.
func WithCalFormatter ¶
WithCalFormatter prepares simple date and time formatting. The date and time formats are configured independently; date-time values render as "<date><sep><time>" using the provided formats. Pass an empty string to keep the ISO default for a given field.
func WithCurrencyTemplate ¶ added in v0.59.0
WithCurrencyTemplate sets a custom template for determining the position of currency units in the formatted amounts. This will modify the currency's default formatter.
func WithDecimalMark ¶ added in v0.59.0
WithDecimalMark sets a custom decimal mark for formatting currency amounts. This will modify the currency's default formatter.
func WithEmbeddedAssets ¶ added in v0.38.0
func WithEmbeddedAssets() Option
WithEmbeddedAssets indicates that the stylesheets and scripts should be embedded inside the HTML document as opposed to links.
func WithHide ¶ added in v0.138.0
WithHide hides the document sections identified by the provided keys using CSS. Hiding a key also hides all of its descendants, so hiding "payment" also hides "payment.terms". Unknown keys are ignored. See HideKeys for the complete list.
func WithLabel ¶ added in v0.52.0
WithLabel indicates that the document should be rendered with the provided label
func WithLayout ¶ added in v0.26.0
WithLayout indicates that the document should be rendered acording to the given Layout.
func WithLocale ¶
WithLocale sets the locale to use for rendering.
func WithLogo ¶
WithLogo overrides whatever logo was defined in the original envelope, if at all, using the provided logo according to the document type.
func WithNegativeTemplate ¶ added in v0.59.0
WithNegativeTemplate sets a custom negative template for formatting currency amounts. This will modify the currency's default formatter.
func WithNumFormatter ¶
WithNumFormatter defines a customer number formatter to use instead of that provided by default for the currency.
func WithSandbox ¶ added in v0.52.0
WithSandbox indicates that the document should be rendered in sandbox mode
func WithThousandsSeparator ¶ added in v0.59.0
WithThousandsSeparator sets a custom thousands separator for formatting currency amounts. This will modify the currency's default formatter.
func WithVoid ¶ added in v0.35.0
WithVoid indicates that the document is marked as void and should be rendered accordingly.
func WithWatermark ¶ added in v0.52.0
WithWatermark indicates that the document should be rendered with the provided watermark
type Warning ¶ added in v0.142.0
Warning flags information that a tax authority requires on the rendered document but which the source document does not provide, such as the recipient's identity on an Australian tax invoice of 1,000 AUD or more. Rendering still goes ahead; warnings are advisory.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package assets contains the static resources for things like styles.
|
Package assets contains the static resources for things like styles. |
|
cmd
|
|
|
gobl.html
command
Package main provides the entry point for the gobl.html command-line tool.
|
Package main provides the entry point for the gobl.html command-line tool. |
|
Package components defines all the templ components that will be used to render GOBL envelopes.
|
Package components defines all the templ components that will be used to render GOBL envelopes. |
|
bill
Package bill provides templates for rendering objects from GOBL's `bill` package.
|
Package bill provides templates for rendering objects from GOBL's `bill` package. |
|
images
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
note
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
org
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
regimes/ar
Package ar provides additional templates and helper methods for the Argentine tax regime.
|
Package ar provides additional templates and helper methods for the Argentine tax regime. |
|
regimes/au
Package au defines extra output for Australian invoices so that the rendered document meets the ATO's information requirements for tax invoices (s 29-70 GST Act, GSTR 2013/1) and adjustment notes (Adjustment Note Information Requirements Determination 2022).
|
Package au defines extra output for Australian invoices so that the rendered document meets the ATO's information requirements for tax invoices (s 29-70 GST Act, GSTR 2013/1) and adjustment notes (Adjustment Note Information Requirements Determination 2022). |
|
regimes/co
Package co provides additional output for Colombian invoices.
|
Package co provides additional output for Colombian invoices. |
|
regimes/es
Package es provides additional templates and helper methods for the Spanish tax regime.
|
Package es provides additional templates and helper methods for the Spanish tax regime. |
|
regimes/gr
Package gr provides additional templates and helper methods for the Greek tax regime.
|
Package gr provides additional templates and helper methods for the Greek tax regime. |
|
regimes/it
Package it provides additional output for Italian invoices.
|
Package it provides additional output for Italian invoices. |
|
regimes/mx
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
regimes/pl
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
regimes/pt
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
regimes/ro
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
regimes/sa
Package sa defines extra output for Saudi Arabian invoices.
|
Package sa defines extra output for Saudi Arabian invoices. |
|
regimes/sg
Package sg provides additional output for Singaporean invoices.
|
Package sg provides additional output for Singaporean invoices. |
|
t
templ: version: v0.3.1001
|
templ: version: v0.3.1001 |
|
taxid
Package taxid formats tax identities according to the way each country officially presents them on invoices.
|
Package taxid formats tax identities according to the way each country officially presents them on invoices. |
|
utils
Package utils provides utility functions for the components package.
|
Package utils provides utility functions for the components package. |
|
Package internal is used for internal option configuration.
|
Package internal is used for internal option configuration. |
|
gallery
Package gallery builds examples/index.html: scan examples/*.json, locale hints, embed catalog.html.
|
Package gallery builds examples/index.html: scan examples/*.json, locale hints, embed catalog.html. |
|
Package layout provides all the possible layouts for a document.
|
Package layout provides all the possible layouts for a document. |
|
Package locales provides all the content for translations.
|
Package locales provides all the content for translations. |
|
pkg
|
|
|
pdf
Package pdf provides a wrapper around different PDF generation tools to provide single conversion process regardless of implementation.
|
Package pdf provides a wrapper around different PDF generation tools to provide single conversion process regardless of implementation. |