summaryrefslogtreecommitdiff
path: root/src/treebuilder
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-11 05:36:14 +0530
committerRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-08-01 21:44:32 +0530
commiteced6089b867895da2cf84f39ef8f46f56ace8d7 (patch)
tree481449913b08680cacd710bc1651991aa1f25acc /src/treebuilder
parentd4f37723baada4e546dc6451d08b1e636dbeae3d (diff)
downloadlibhubbub-eced6089b867895da2cf84f39ef8f46f56ace8d7.tar.gz
libhubbub-eced6089b867895da2cf84f39ef8f46f56ace8d7.tar.bz2
Small fix to handle rp/rt start tag in body
Diffstat (limited to 'src/treebuilder')
-rw-r--r--src/treebuilder/in_body.c25
-rw-r--r--src/treebuilder/treebuilder.c2
2 files changed, 26 insertions, 1 deletions
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;
@@ -1441,6 +1443,27 @@ hubbub_error process_opt_in_body(hubbub_treebuilder *treebuilder,
}
/**
+ * 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"
*
* \param treebuilder The treebuilder instance
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 },