1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! HTML spec data and the answers the HTML spec gives — part of
//! [tsv](https://github.com/fuzdev/tsv), published for tsv's Svelte support
//! ([`tsv_svelte`](https://docs.rs/tsv_svelte)). The long-term target is a spec-faithful HTML
//! library; today the crate holds what tsv's Svelte parser reads from the spec: the
//! [named character references][table] table, matched as the tokenizer matches it
//! ([`match_named_character_reference`], answering a [`NamedCharacterReference`]).
//!
//! The lookup is a pure function over text, independent of any one parser or tool. Names are
//! matched exactly, as authored: the lookup is case-sensitive, as the spec's table is
//! (`Á` and `á` are different references).
//!
//! ```
//! use tsv_html::match_named_character_reference;
//!
//! // `<` names `<`, its `;` included
//! let lt = match_named_character_reference("lt;").unwrap();
//! assert_eq!((lt.name(), lt.characters()), ("lt;", "<"));
//! // the longest name that starts the text wins: `∉` over `¬`
//! let notin = match_named_character_reference("notin;").unwrap();
//! assert_eq!((notin.name(), notin.characters()), ("notin;", "∉"));
//! ```
//!
//! ## Stability
//!
//! The public signatures follow 0.x semver like every tsv crate: a breaking change ships only
//! in a minor release. What the lookup answers may change in any release, tracking the spec
//! and what tsv needs.
//!
//! ## License
//!
//! The named-reference table is generated from WHATWG's `entities.json` and compiled in
//! under BSD-3-Clause, beside tsv's own 0BSD (the crate's license is `0BSD AND
//! BSD-3-Clause`); the crate's `NOTICE` file carries the attribution and both licenses.
//!
//! [table]: https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
pub use ;