19 #define S(s) { s, sizeof s - 1 } 25 S(
"+//Silmaril//dtd html Pro v0r11 19970101//"),
26 S(
"-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//"),
27 S(
"-//AS//DTD HTML 3.0 asWedit + extensions//"),
28 S(
"-//IETF//DTD HTML 2.0 Level 1//"),
29 S(
"-//IETF//DTD HTML 2.0 Level 2//"),
30 S(
"-//IETF//DTD HTML 2.0 Strict Level 1//"),
31 S(
"-//IETF//DTD HTML 2.0 Strict Level 2//"),
32 S(
"-//IETF//DTD HTML 2.0 Strict//"),
33 S(
"-//IETF//DTD HTML 2.0//"),
34 S(
"-//IETF//DTD HTML 2.1E//"),
35 S(
"-//IETF//DTD HTML 3.0//"),
36 S(
"-//IETF//DTD HTML 3.2 Final//"),
37 S(
"-//IETF//DTD HTML 3.2//"),
38 S(
"-//IETF//DTD HTML 3//"),
39 S(
"-//IETF//DTD HTML Level 0//"),
40 S(
"-//IETF//DTD HTML Level 1//"),
41 S(
"-//IETF//DTD HTML Level 2//"),
42 S(
"-//IETF//DTD HTML Level 3//"),
43 S(
"-//IETF//DTD HTML Strict Level 0//"),
44 S(
"-//IETF//DTD HTML Strict Level 1//"),
45 S(
"-//IETF//DTD HTML Strict Level 2//"),
46 S(
"-//IETF//DTD HTML Strict Level 3//"),
47 S(
"-//IETF//DTD HTML Strict//"),
48 S(
"-//IETF//DTD HTML//"),
49 S(
"-//Metrius//DTD Metrius Presentational//"),
50 S(
"-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//"),
51 S(
"-//Microsoft//DTD Internet Explorer 2.0 HTML//"),
52 S(
"-//Microsoft//DTD Internet Explorer 2.0 Tables//"),
53 S(
"-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//"),
54 S(
"-//Microsoft//DTD Internet Explorer 3.0 HTML//"),
55 S(
"-//Microsoft//DTD Internet Explorer 3.0 Tables//"),
56 S(
"-//Netscape Comm. Corp.//DTD HTML//"),
57 S(
"-//Netscape Comm. Corp.//DTD Strict HTML//"),
58 S(
"-//O'Reilly and Associates//DTD HTML 2.0//"),
59 S(
"-//O'Reilly and Associates//DTD HTML Extended 1.0//"),
60 S(
"-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//"),
61 S(
"-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//"),
62 S(
"-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//"),
63 S(
"-//Spyglass//DTD HTML 2.0 Extended//"),
64 S(
"-//SQ//DTD HTML 2.0 HoTMetaL + extensions//"),
65 S(
"-//Sun Microsystems Corp.//DTD HotJava HTML//"),
66 S(
"-//Sun Microsystems Corp.//DTD HotJava Strict HTML//"),
67 S(
"-//W3C//DTD HTML 3 1995-03-24//"),
68 S(
"-//W3C//DTD HTML 3.2 Draft//"),
69 S(
"-//W3C//DTD HTML 3.2 Final//"),
70 S(
"-//W3C//DTD HTML 3.2//"),
71 S(
"-//W3C//DTD HTML 3.2S Draft//"),
72 S(
"-//W3C//DTD HTML 4.0 Frameset//"),
73 S(
"-//W3C//DTD HTML 4.0 Transitional//"),
74 S(
"-//W3C//DTD HTML Experimental 19960712//"),
75 S(
"-//W3C//DTD HTML Experimental 970421//"),
76 S(
"-//W3C//DTD W3 HTML//"),
77 S(
"-//W3O//DTD W3 HTML 3.0//"),
91 static bool starts_with(
const uint8_t *a,
size_t a_len,
const uint8_t *b,
115 size_t name_len = cdoc->
name.
len;
125 #define S(s) (uint8_t *) s, sizeof s - 1 145 S(
"-//W3O//DTD W3 HTML Strict 3.0//EN//")) ||
147 S(
"-/W3C/DTD HTML 4.0 Transitional/EN")) ||
151 S(
"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"))) {
157 S(
"-//W3C//DTD HTML 4.01 Frameset//")) ||
159 S(
"-//W3C//DTD HTML 4.01 Transitional//")))) {
184 #define S(s) (uint8_t *) s, sizeof s - 1 187 S(
"-//W3C//DTD XHTML 1.0 Frameset//")) ||
189 S(
"-//W3C//DTD XHTML 1.0 Transitional//"))) {
195 S(
"-//W3C//DTD HTML 4.01 Frameset//")) ||
197 S(
"-//W3C//DTD HTML 4.01 Transitional//")))) {
219 switch (token->
type) {
238 void *doctype, *appended;
hubbub_error process_comment_append(hubbub_treebuilder *treebuilder, const hubbub_token *token, void *parent)
Process a comment token, appending it to the given parent.
hubbub_token_type type
The token type.
hubbub_tree_create_doctype create_doctype
Create doctype.
void * ctx
Context pointer.
hubbub_tree_handler * tree_handler
Callback table.
const uint8_t * ptr
Pointer to data.
hubbub_error process_characters_expect_whitespace(hubbub_treebuilder *treebuilder, const hubbub_token *token, bool insert_into_current_node)
Process a character token in cases where we expect only whitespace.
hubbub_string public_id
Doctype public identifier.
bool system_missing
Whether the system id is missing.
insertion_mode mode
The current insertion mode.
size_t len
Byte length of string.
bool hubbub_string_match_ci(const uint8_t *a, size_t a_len, const uint8_t *b, size_t b_len)
Check that one string is case-insensitively equal to another.
static bool starts_with(const uint8_t *a, size_t a_len, const uint8_t *b, size_t b_len)
Check if one string starts with another.
hubbub_error handle_initial(hubbub_treebuilder *treebuilder, const hubbub_token *token)
Handle token in initial insertion mode.
hubbub_treebuilder_context context
Our context.
hubbub_string system_id
Doctype system identifier.
hubbub_string name
Doctype name.
hubbub_tree_unref_node unref_node
Unreference node.
hubbub_tree_set_quirks_mode set_quirks_mode
Set quirks mode.
void * document
Pointer to the document node.
struct @12 public_doctypes[]
union hubbub_token::@3 data
Type-specific data.
static bool lookup_limited_quirks(hubbub_treebuilder *treebuilder, const hubbub_doctype *cdoc)
Determine whether this doctype triggers limited quirks mode.
bool force_quirks
Doctype force-quirks flag.
hubbub_tree_append_child append_child
Append child.
bool public_missing
Whether the public id is missing.
static bool lookup_full_quirks(hubbub_treebuilder *treebuilder, const hubbub_doctype *cdoc)
Determine whether this doctype triggers full quirks mode.