diff options
author | Andrew Sidwell <andy@entai.co.uk> | 2008-07-11 12:41:18 +0000 |
---|---|---|
committer | Andrew Sidwell <andy@entai.co.uk> | 2008-07-11 12:41:18 +0000 |
commit | 980c7f46f3da56351fd75570f78fb6617fba4c07 (patch) | |
tree | ad5d4f1519cb083169b7e4e1911886ae44b57ac1 /src | |
parent | 4bcd5dfb3a6d139a3290a2dd3e51a3494b00c692 (diff) | |
download | libhubbub-980c7f46f3da56351fd75570f78fb6617fba4c07.tar.gz libhubbub-980c7f46f3da56351fd75570f78fb6617fba4c07.tar.bz2 |
Fix <isindex> processing.
svn path=/trunk/hubbub/; revision=4590
Diffstat (limited to 'src')
-rw-r--r-- | src/treebuilder/in_body.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/treebuilder/in_body.c b/src/treebuilder/in_body.c index 9722ed3..c7d36b0 100644 --- a/src/treebuilder/in_body.c +++ b/src/treebuilder/in_body.c @@ -871,8 +871,9 @@ void process_isindex_in_body(hubbub_treebuilder *treebuilder, /* First up, clone the token's attributes */ if (token->data.tag.n_attributes > 0) { attrs = treebuilder->alloc(NULL, - token->data.tag.n_attributes * sizeof(hubbub_attribute), - treebuilder->alloc_pw); + (token->data.tag.n_attributes + 1) * + sizeof(hubbub_attribute), + treebuilder->alloc_pw); if (attrs == NULL) { /** \todo error handling */ return; @@ -889,10 +890,20 @@ void process_isindex_in_body(hubbub_treebuilder *treebuilder, } else if (strncmp((const char *) name, "prompt", attr->name.len) == 0) { prompt = attr; + } else if (strncmp((const char *) name, "name", + attr->name.len) == 0) { } else { attrs[n_attrs++] = *attr; } } + + attrs[n_attrs].name.type = HUBBUB_STRING_PTR; + attrs[n_attrs].name.data.ptr = (const uint8_t *) "name"; + attrs[n_attrs].name.len = SLEN("name"); + attrs[n_attrs].value.type = HUBBUB_STRING_PTR; + attrs[n_attrs].value.data.ptr = (const uint8_t *) "isindex"; + attrs[n_attrs].value.len = SLEN("isindex"); + n_attrs++; } /* isindex algorithm */ @@ -941,7 +952,7 @@ void process_isindex_in_body(hubbub_treebuilder *treebuilder, dummy.data.character = prompt->value; } else { /** \todo Localisation */ -#define PROMPT "This is a searchable index. Insert your search keywords here:" +#define PROMPT "This is a searchable index. Insert your search keywords here: " dummy.data.character.type = HUBBUB_STRING_PTR; dummy.data.character.data.ptr = (const uint8_t *) PROMPT; dummy.data.character.len = SLEN(PROMPT); |