Hubbub
|
#include <assert.h>
#include <string.h>
#include "treebuilder/modes.h"
#include "treebuilder/internal.h"
#include "treebuilder/treebuilder.h"
#include "utils/utils.h"
Go to the source code of this file.
Data Structures | |
struct | case_changes |
Mapping table for case changes. More... | |
Macros | |
#define | S(s) s, SLEN(s) |
#define | S(s) (uint8_t *) s, SLEN(s) |
Functions | |
void | adjust_mathml_attributes (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust MathML attributes. More... | |
void | adjust_svg_attributes (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust SVG attributes. More... | |
void | adjust_svg_tagname (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust SVG tagnmes. More... | |
void | adjust_foreign_attributes (hubbub_treebuilder *treebuilder, hubbub_tag *tag) |
Adjust foreign attributes. More... | |
static bool | element_in_scope_in_non_html_ns (hubbub_treebuilder *treebuilder) |
Returns true iff there is an element in scope that has a namespace other than the HTML namespace. More... | |
static hubbub_error | process_as_in_secondary (hubbub_treebuilder *treebuilder, const hubbub_token *token) |
Process a token as if in the secondary insertion mode. More... | |
static void | foreign_break_out (hubbub_treebuilder *treebuilder) |
Break out of foreign content as a result of certain start tags or EOF. More... | |
hubbub_error | handle_in_foreign_content (hubbub_treebuilder *treebuilder, const hubbub_token *token) |
Handle tokens in "in foreign content" insertion mode. More... | |
Variables | |
static const case_changes | svg_attributes [] |
static const case_changes | svg_tagnames [] |
#define S | ( | s | ) | s, SLEN(s) |
Definition at line 219 of file in_foreign_content.c.
Referenced by adjust_foreign_attributes(), and handle_in_foreign_content().
#define S | ( | s | ) | (uint8_t *) s, SLEN(s) |
Definition at line 219 of file in_foreign_content.c.
void adjust_foreign_attributes | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust foreign attributes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the attributes of |
Definition at line 227 of file in_foreign_content.c.
References hubbub_tag::attributes, HUBBUB_NS_XLINK, HUBBUB_NS_XML, HUBBUB_NS_XMLNS, hubbub_string_match(), len, hubbub_string::len, hubbub_tag::n_attributes, name, hubbub_attribute::name, hubbub_attribute::ns, hubbub_string::ptr, S, SLEN, and UNUSED.
Referenced by handle_in_foreign_content(), and process_start_tag().
void adjust_mathml_attributes | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust MathML attributes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the attributes of |
Definition at line 144 of file in_foreign_content.c.
References hubbub_tag::attributes, hubbub_string_match(), len, hubbub_string::len, hubbub_tag::n_attributes, name, hubbub_attribute::name, hubbub_string::ptr, SLEN, and UNUSED.
Referenced by process_start_tag().
void adjust_svg_attributes | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust SVG attributes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the attributes of |
Definition at line 169 of file in_foreign_content.c.
References hubbub_tag::attributes, hubbub_string_match(), len, hubbub_string::len, hubbub_tag::n_attributes, N_ELEMENTS, name, hubbub_attribute::name, hubbub_string::ptr, svg_attributes, and UNUSED.
Referenced by handle_in_foreign_content(), and process_start_tag().
void adjust_svg_tagname | ( | hubbub_treebuilder * | treebuilder, |
hubbub_tag * | tag | ||
) |
Adjust SVG tagnmes.
treebuilder | Treebuilder instance |
tag | Tag to adjust the name of |
Definition at line 199 of file in_foreign_content.c.
References hubbub_string_match(), len, hubbub_string::len, N_ELEMENTS, name, hubbub_tag::name, hubbub_string::ptr, svg_tagnames, and UNUSED.
Referenced by handle_in_foreign_content().
|
static |
Returns true iff there is an element in scope that has a namespace other than the HTML namespace.
Definition at line 301 of file in_foreign_content.c.
References hubbub_treebuilder::context, hubbub_treebuilder_context::current_node, hubbub_treebuilder_context::element_stack, HUBBUB_NS_HTML, is_scoping_element(), TABLE, and element_context::type.
Referenced by process_as_in_secondary().
|
static |
Break out of foreign content as a result of certain start tags or EOF.
Definition at line 361 of file in_foreign_content.c.
References hubbub_treebuilder::context, hubbub_tree_handler::ctx, hubbub_treebuilder_context::current_node, hubbub_treebuilder_context::element_stack, element_stack_pop(), HUBBUB_NS_HTML, hubbub_treebuilder_context::mode, element_context::ns, hubbub_treebuilder_context::second_mode, hubbub_treebuilder::tree_handler, type, and hubbub_tree_handler::unref_node.
Referenced by handle_in_foreign_content().
hubbub_error handle_in_foreign_content | ( | hubbub_treebuilder * | treebuilder, |
const hubbub_token * | token | ||
) |
Handle tokens in "in foreign content" insertion mode.
treebuilder | The treebuilder instance |
token | The token to process |
Definition at line 390 of file in_foreign_content.c.
References adjust_foreign_attributes(), adjust_svg_attributes(), adjust_svg_tagname(), ANNOTATION_XML, append_text(), hubbub_tag::attributes, B, BIG, BLOCKQUOTE, BODY, BR, CENTER, hubbub_token::character, CODE, hubbub_treebuilder::context, hubbub_treebuilder_context::current_node, current_node(), hubbub_token::data, DD, DESC, DIV, DL, DT, hubbub_treebuilder_context::element_stack, element_type_from_name(), EM, EMBED, FONT, foreign_break_out(), FOREIGNOBJECT, H1, H2, H3, H4, H5, H6, HEAD, HR, HUBBUB_NS_HTML, HUBBUB_NS_MATHML, HUBBUB_NS_SVG, HUBBUB_OK, HUBBUB_REPROCESS, hubbub_string_match(), HUBBUB_TOKEN_CHARACTER, HUBBUB_TOKEN_COMMENT, HUBBUB_TOKEN_DOCTYPE, HUBBUB_TOKEN_END_TAG, HUBBUB_TOKEN_EOF, HUBBUB_TOKEN_START_TAG, I, IMG, insert_element(), len, hubbub_string::len, LI, LISTING, MALIGNMARK, MENU, META, MGLYPH, MI, MN, MO, MS, MTEXT, hubbub_tag::n_attributes, name, hubbub_attribute::name, hubbub_tag::name, NOBR, element_context::node, element_context::ns, hubbub_tag::ns, OL, P, PRE, process_as_in_secondary(), process_comment_append(), hubbub_string::ptr, RUBY, S, hubbub_tag::self_closing, SLEN, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, SVG, TABLE, hubbub_token::tag, TITLE, TT, type, hubbub_token::type, U, UL, and VAR.
Referenced by hubbub_treebuilder_token_handler().
|
static |
Process a token as if in the secondary insertion mode.
Definition at line 329 of file in_foreign_content.c.
References hubbub_treebuilder::context, element_in_scope_in_non_html_ns(), HUBBUB_OK, hubbub_treebuilder_token_handler(), IN_FOREIGN_CONTENT, hubbub_treebuilder_context::mode, and hubbub_treebuilder_context::second_mode.
Referenced by handle_in_foreign_content().
|
static |
Definition at line 32 of file in_foreign_content.c.
Referenced by adjust_svg_attributes().
|
static |
Definition at line 97 of file in_foreign_content.c.
Referenced by adjust_svg_tagname().