From eced6089b867895da2cf84f39ef8f46f56ace8d7 Mon Sep 17 00:00:00 2001 From: Rupinder Singh Khokhar Date: Fri, 11 Jul 2014 05:36:14 +0530 Subject: Small fix to handle rp/rt start tag in body --- src/treebuilder/in_body.c | 25 ++++++++++++++++++++++++- src/treebuilder/treebuilder.c | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/treebuilder/in_body.c b/src/treebuilder/in_body.c index f4ac2ad..cf3630d 100644 --- a/src/treebuilder/in_body.c +++ b/src/treebuilder/in_body.c @@ -72,6 +72,8 @@ static hubbub_error process_select_in_body(hubbub_treebuilder *treebuilder, const hubbub_token *token); static hubbub_error process_opt_in_body(hubbub_treebuilder *treebuilder, const hubbub_token *token); +static hubbub_error process_rp_rt_in_body(hubbub_treebuilder *treebuilder, + const hubbub_token *token); static hubbub_error process_phrasing_in_body(hubbub_treebuilder *treebuilder, const hubbub_token *token); @@ -398,7 +400,7 @@ hubbub_error process_start_tag(hubbub_treebuilder *treebuilder, } else if (type == OPTGROUP || type == OPTION) { err = process_opt_in_body(treebuilder, token); } else if (type == RP || type == RT) { - /** \todo ruby */ + err = process_rp_rt_in_body(treebuilder, token); } else if (type == MATH || type == SVG) { hubbub_tag tag = token->data.tag; @@ -1440,6 +1442,27 @@ hubbub_error process_opt_in_body(hubbub_treebuilder *treebuilder, return insert_element(treebuilder, &token->data.tag, true); } +/** + * Process a rp or rt start tag as if in "in body" + * + * \param treebuilder The treebuilder instance + * \param token The token to process + */ +hubbub_error process_rp_rt_in_body(hubbub_treebuilder *treebuilder, + const hubbub_token *token) +{ + if(element_in_scope(treebuilder, RUBY, NONE)) { + close_implied_end_tags(treebuilder, UNKNOWN); + } + + if(treebuilder->context.element_stack[ + treebuilder->context.current_node].type != RUBY) { + /** \todo parse error */ + } + + return insert_element(treebuilder, &token->data.tag, true); +} + /** * Process a phrasing start tag as if in "in body" * diff --git a/src/treebuilder/treebuilder.c b/src/treebuilder/treebuilder.c index 32d7932..6b89355 100644 --- a/src/treebuilder/treebuilder.c +++ b/src/treebuilder/treebuilder.c @@ -61,6 +61,8 @@ static const struct { { S("option"), OPTION }, { S("output"), OUTPUT }, { S("p"), P }, { S("param"), PARAM }, { S("plaintext"), PLAINTEXT }, { S("pre"), PRE }, + { S("ruby"), RUBY }, + { S("rp"), RP }, { S("rt"), RT }, { S("script"), SCRIPT }, { S("section"), SECTION }, { S("select"), SELECT }, { S("source"), SOURCE }, { S("spacer"), SPACER }, { S("style"), STYLE }, -- cgit v1.2.3