entity

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 6 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const MaxName = 31

MaxName is the length of the longest name, without "&" and ";".

Variables

This section is empty.

Functions

func Classic

func Classic(name string) (string, bool)

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 Len

func Len() int

Len returns the number of names in the table, legacy forms included.

func Lookup

func Lookup(name string) (string, bool)

Lookup returns what the reference "&name" stands for, name including its ";" if it has one.

func Named

func Named(s []byte) (repl string, n int, semicolon, ok bool)

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

func Numeric(v int64) rune

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.

Jump to

Keyboard shortcuts

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