Documentation
¶
Overview ¶
Package entity resolves HTML character references: the named references of the WHATWG HTML standard (section 13.5, embedded from entities.txt) and the numeric ones with the standard's replacement rules. Moved here from go-fast-html and go-fast-xml (internal/entity; xml's had Classic as well), so that both read references the same way.
Index ¶
Constants ¶
const MaxName = 31
MaxName is the length of the longest name, without "&" and ";".
Variables ¶
This section is empty.
Functions ¶
func Classic ¶
Classic returns what the HTML 4 character entity "&name;" stands for; name has no "&" and no ";". A name outside that set is not found, even when the HTML standard has one of that name: such names are not the same in every vocabulary.
func Lookup ¶
Lookup returns what the reference "&name" stands for, name including its ";" if it has one.
func Named ¶
Named finds the longest named character reference at the start of s, which follows an "&". It returns what the reference stands for, the bytes of s it takes (its ";" included when it has one), and whether that final ";" was there.
func Numeric ¶
Numeric returns the character a numeric character reference to code point v stands for, following the standard's "numeric character reference end state": zero, a surrogate or a value beyond U+10FFFF is U+FFFD, and a C1 control is the windows-1252 character of its byte. Other noncharacters and controls are returned as they are.
Types ¶
This section is empty.