From 4a921e9259893edfda37a432caca24a3f43c60c1 Mon Sep 17 00:00:00 2001 From: konn Date: Wed, 16 Jul 2008 10:47:07 +0000 Subject: [PATCH] * Added form tag with CSS for CHTML1.0 converter. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/sandbox@2955 1a406e8e-add9-4483-a2c8-d8cac5b7c224 --- src/chxj_chtml10.c | 51 ++++++++++++++++++++++++----------- test/chxj_chtml10/test_chxj_chtml10.c | 4 ++- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/chxj_chtml10.c b/src/chxj_chtml10.c index 82a828e1..f16b8ed7 100644 --- a/src/chxj_chtml10.c +++ b/src/chxj_chtml10.c @@ -2028,17 +2028,18 @@ s_chtml10_end_tr_tag(void *pdoc, Node *UNUSED(child)) static char * s_chtml10_start_form_tag(void *pdoc, Node *node) { - chtml10_t *chtml10; - Doc *doc; - request_rec *r; - Attr *attr; + chtml10_t *chtml10; + Doc *doc; + request_rec *r; + Attr *attr; + char *attr_style = NULL; + char *attr_action = NULL; + char *attr_method = NULL; chtml10 = GET_CHTML10(pdoc); doc = chtml10->doc; r = doc->r; - W_L("cookie); - - W_L(" action=\""); - W_V(value); - W_L("\""); + attr_action = value; } break; @@ -2069,9 +2065,7 @@ s_chtml10_start_form_tag(void *pdoc, Node *node) /*--------------------------------------------------------------------*/ /* CHTML 1.0 */ /*--------------------------------------------------------------------*/ - W_L(" method=\""); - W_V(value); - W_L("\""); + attr_method = value; } break; @@ -2085,11 +2079,33 @@ s_chtml10_start_form_tag(void *pdoc, Node *node) } break; + case 's': + case 'S': + if (strcasecmp(name, "style") == 0 && value && *value) { + attr_style = value; + } + break; + default: break; } } - + if (IS_CSS_ON(chtml10->entryp)) { + s_chtml10_push_and_get_now_style(pdoc, node, attr_style); + } + W_L("cookie); + W_L(" action=\""); + W_V(attr_action); + W_L("\""); + } + if (attr_method) { + W_L(" method=\""); + W_V(attr_method); + W_L("\""); + } W_L(">"); return chtml10->out; @@ -2116,6 +2132,9 @@ s_chtml10_end_form_tag(void *pdoc, Node *UNUSED(child)) r = doc->r; W_L(""); + if (IS_CSS_ON(chtml10->entryp)) { + chxj_css_pop_prop_list(chtml10->css_prop_stack); + } return chtml10->out; } diff --git a/test/chxj_chtml10/test_chxj_chtml10.c b/test/chxj_chtml10/test_chxj_chtml10.c index 5ee35dd7..5d3b7d7f 100644 --- a/test/chxj_chtml10/test_chxj_chtml10.c +++ b/test/chxj_chtml10/test_chxj_chtml10.c @@ -2777,7 +2777,7 @@ void test_chtml10_form_tag_008() void test_chtml10_form_tag_009() { #define TEST_STRING "
" -#define RESULT_STRING "
" +#define RESULT_STRING "
" char *ret; char *tmp; device_table spec; @@ -2794,6 +2794,8 @@ void test_chtml10_form_tag_009() tmp = chxj_encoding(&r, TEST_STRING, &destlen); ret = chxj_convert_chtml10(&r, &spec, tmp, destlen, &destlen, &entry, &cookie); ret = chxj_rencoding(&r, ret, &destlen); + fprintf(stderr, "actual:[%s]\n", ret); + fprintf(stderr, "expect:[%s]\n", RESULT_STRING); CU_ASSERT(ret != NULL); CU_ASSERT(strcmp(RESULT_STRING, ret) == 0); CU_ASSERT(destlen == sizeof(RESULT_STRING)-1); -- 2.11.0