Documentation
¶
Index ¶
- Constants
- func ApplyCSSDeclaration(node *html.Node, decl *css.Declaration, inlineAttrs map[string]struct{})
- func ApplyPreparedStylesheet(root *html.Node, stylesheet *PreparedStylesheet) error
- func AttrVal(n *html.Node, key string) string
- func CSSDeclarationToAttr(decl *css.Declaration) (string, string, bool)
- func CaptureAttrNames(root *html.Node) map[*html.Node]map[string]struct{}
- func CollectText(n *html.Node) string
- func ElemChildren(n *html.Node) []*html.Node
- func ExecuteNamedFromSourcesWithFuncs(templateSources []string, templateName string, data any, ...) (string, error)
- func ExecuteNamedFromSourcesWithOptions(templateSources []string, templateName string, data any, ...) (string, error)
- func ExecuteNamedWithFuncs(templateSource, templateName string, data any, funcs template.FuncMap) (string, error)
- func FindFirst(n *html.Node, tag string) *html.Node
- func FindFirstByID(n *html.Node, tag, id string) *html.Node
- func NormaliseInlineTextNode(raw string) string
- func ParseBorderShorthand(value string) (width float64, style, color string)
- func ParseCSSPageSettings(cssText string, defaults PageSettings, ...) (PageSettings, PageSettings, error)
- func ParseLengthValue(raw string) (float64, bool)
- func ParsePreparedStyledFragment(htmlStr string, stylesheet *PreparedStylesheet) (*html.Node, error)
- func ParseRunningFooterName(cssText string) (string, bool)
- func ParseStyledFragment(htmlStr, cssText string) (*html.Node, error)
- func ResolveNamedPageSize(name string) (float64, float64, bool)
- func SetOrReplaceAttr(node *html.Node, key, value string)
- func SupportedCSSProperties() []string
- type CSSSupportDiagnostic
- type ExecuteOptions
- type OutputLimitError
- type PageMargins
- type PageSettings
- type PreparedStylesheet
- type PreparedTemplates
Constants ¶
View Source
const ( A4Width = 595.28 A4Height = 841.89 )
View Source
const UnsupportedCSSPropertyCode = "CSS001"
Variables ¶
This section is empty.
Functions ¶
func ApplyCSSDeclaration ¶
func ApplyCSSDeclaration(node *html.Node, decl *css.Declaration, inlineAttrs map[string]struct{})
func ApplyPreparedStylesheet ¶
func ApplyPreparedStylesheet(root *html.Node, stylesheet *PreparedStylesheet) error
func CSSDeclarationToAttr ¶
func CSSDeclarationToAttr(decl *css.Declaration) (string, string, bool)
func CollectText ¶
func ExecuteNamedWithFuncs ¶
func NormaliseInlineTextNode ¶
func ParseBorderShorthand ¶
func ParseCSSPageSettings ¶
func ParseCSSPageSettings(cssText string, defaults PageSettings, parseLength func(string) (float64, bool)) (PageSettings, PageSettings, error)
func ParseLengthValue ¶
func ParsePreparedStyledFragment ¶
func ParsePreparedStyledFragment(htmlStr string, stylesheet *PreparedStylesheet) (*html.Node, error)
func ParseRunningFooterName ¶
ParseRunningFooterName returns the running footer name when both rules exist:
- footer { position: running(name); }
- @page { @bottom-center { content: element(name); } }
and both names match.
func ResolveNamedPageSize ¶
ResolveNamedPageSize returns width and height in points for a known CSS named page size, case-insensitive.
func SetOrReplaceAttr ¶
func SupportedCSSProperties ¶
func SupportedCSSProperties() []string
Types ¶
type CSSSupportDiagnostic ¶
func AnalyzeCSSSupport ¶
func AnalyzeCSSSupport(cssText string) ([]CSSSupportDiagnostic, error)
func (CSSSupportDiagnostic) Error ¶
func (d CSSSupportDiagnostic) Error() string
type ExecuteOptions ¶
type OutputLimitError ¶
type OutputLimitError struct {
Limit int64
}
func (*OutputLimitError) Error ¶
func (e *OutputLimitError) Error() string
func (*OutputLimitError) Is ¶
func (e *OutputLimitError) Is(target error) bool
type PageMargins ¶
type PageSettings ¶
type PageSettings struct {
Width float64
Height float64
Margins PageMargins
}
type PreparedStylesheet ¶
type PreparedStylesheet struct {
// contains filtered or unexported fields
}
func PrepareStylesheet ¶
func PrepareStylesheet(cssText string) (*PreparedStylesheet, error)
type PreparedTemplates ¶
type PreparedTemplates struct {
// contains filtered or unexported fields
}
func PrepareTemplates ¶
func PrepareTemplates(templateSources []string, funcs template.FuncMap) (*PreparedTemplates, error)
func (*PreparedTemplates) Execute ¶
func (prepared *PreparedTemplates) Execute(templateName string, data any, funcs template.FuncMap, options ExecuteOptions) (string, error)
Click to show internal directories.
Click to hide internal directories.