htmlser

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package htmlser holds the HTML rules of Serialization 3.1 that both serialisers apply: the full one in xslt and fn:serialize's in xpath. xslt imports xpath, so neither can hold them for the other.

Index

Constants

View Source
const NSXHTML = "http://www.w3.org/1999/xhtml"

NSXHTML is the XHTML namespace.

Variables

This section is empty.

Functions

func Inline

func Inline(n *xdm.Node, xhtml, html5 bool) bool

Inline reports whether n is an inline element in the sense of Serialization 3.1 §7.4.3 (html) and §6.1.4 (xhtml), next to which indentation "MUST NOT" add whitespace: an element the method treats as HTML whose name is in inlineNames. The html method treats an element in no namespace as HTML, and one in the XHTML namespace under HTML5, matching names without regard to case; the xhtml method one in the XHTML namespace, or in none under HTML5. ponytail: area, link and meta, phrasing only in some positions, are left out.

func MetaContent

func MetaContent(mediaType, encoding string) string

MetaContent is the content attribute of the meta element the html and xhtml methods add (§7.4.13, §6.1.14): the media-type parameter, text/html when absent, and the charset, UTF-8 when no encoding is given.

func ReplacedMeta

func ReplacedMeta(head, n *xdm.Node) bool

ReplacedMeta reports whether n is a meta element the html and xhtml methods discard from head, the <head> they have added their own content-type meta to. §7.4.13 and §6.1.14: "any existing meta element child of the head element having an http-equiv attribute with the value "Content-Type", making the comparison without regard to case after first stripping leading and trailing spaces ... MUST be discarded". A child only: a meta deeper in head is left alone. The HTML5 charset spelling of the same declaration is discarded too, as Saxon does, since it would contradict the added one.

func SkipIndentBefore

func SkipIndentBefore(n *xdm.Node, i int, xhtml, html5 bool) bool

SkipIndentBefore reports whether no indent may go before child i of n's children (i == len(children) meaning before n's end tag): next to an inline child, or before the end tag of an inline element. The boundaries inside an element follow Saxon, which the spec permits: an indent may follow the start tag of an inline element, but none goes before its end tag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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