Doc *doc;
request_rec *r;
Attr *attr;
+ char *attr_style = NULL;
+ char *attr_start = NULL;
+ char *attr_type = NULL;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- W_L("<ol");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
char *name = qs_get_attr_name(doc,attr);
char *value = qs_get_attr_value(doc,attr);
if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
- W_L(" type=\"");
- W_V(value);
- W_L("\"");
+ attr_type = value;
}
else if (STRCASEEQ('s','S',"start",name) && value && *value) {
- W_L(" start=\"");
- W_V(value);
- W_L("\"");
+ attr_start = value;
+ }
+ else if (STRCASEEQ('s','S',"style", name) && value && *value) {
+ attr_style = value;
+ }
+ }
+ if (IS_CSS_ON(jhtml->entryp)) {
+ css_prop_list_t *style = s_jhtml_push_and_get_now_style(pdoc, node, attr_style);
+ if (style) {
+ css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
+ css_property_t *cur;
+ for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+ if (STRCASEEQ('d','D',"decimal", cur->value)) {
+ attr_type = apr_pstrdup(doc->pool, "1");
+ }
+ else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
+ attr_type = apr_pstrdup(doc->pool, "A");
+ }
+ else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
+ attr_type = apr_pstrdup(doc->pool, "a");
+ }
+ }
}
}
+ W_L("<ol");
+ if (attr_type) {
+ W_L(" type=\"");
+ W_V(attr_type);
+ W_L("\"");
+ }
+ if (attr_start) {
+ W_L(" start=\"");
+ W_V(attr_start);
+ W_L("\"");
+ }
W_L(">");
+
return jhtml->out;
}
r = doc->r;
W_L("</ol>");
+ if (IS_CSS_ON(jhtml->entryp)) {
+ chxj_css_pop_prop_list(jhtml->css_prop_stack);
+ }
return jhtml->out;
}
void test_jhtml_li_tag_with_css_010();
void test_jhtml_li_tag_with_css_011();
void test_jhtml_li_tag_with_css_012();
+
+void test_jhtml_ol_tag_with_css_001();
+void test_jhtml_ol_tag_with_css_002();
+void test_jhtml_ol_tag_with_css_003();
+void test_jhtml_ol_tag_with_css_004();
+void test_jhtml_ol_tag_with_css_005();
+void test_jhtml_ol_tag_with_css_006();
/* pend */
int
CU_add_test(jhtml_suite, "test li with css 010", test_jhtml_li_tag_with_css_010);
CU_add_test(jhtml_suite, "test li with css 011", test_jhtml_li_tag_with_css_011);
CU_add_test(jhtml_suite, "test li with css 012", test_jhtml_li_tag_with_css_012);
+
+ CU_add_test(jhtml_suite, "test ol with css 001", test_jhtml_ol_tag_with_css_001);
+ CU_add_test(jhtml_suite, "test ol with css 002", test_jhtml_ol_tag_with_css_002);
+ CU_add_test(jhtml_suite, "test ol with css 003", test_jhtml_ol_tag_with_css_003);
+ CU_add_test(jhtml_suite, "test ol with css 004", test_jhtml_ol_tag_with_css_004);
+ CU_add_test(jhtml_suite, "test ol with css 005", test_jhtml_ol_tag_with_css_005);
+ CU_add_test(jhtml_suite, "test ol with css 006", test_jhtml_ol_tag_with_css_006);
/* aend */
CU_basic_run_tests();
#undef TEST_STRING
#undef RESULT_STRING
}
+
+
+/*===========================================================================*/
+/* ol tag with CSS */
+/*===========================================================================*/
+char *test_chxj_serf_get030(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+ static char *css = "a:focus { display: none }\n"
+ "a:link { display: none }\n"
+ "a { display: none }\n"
+ "hr { display: none }\n"
+ "a:visited { display:none }\n"
+ "ol { list-style-type: decimal }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jhtml_ol_tag_with_css_001()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><body><ol><li>あいう</li><li>かきく</li></ul></body></html>"
+#define RESULT_STRING "<html><head></head><body><ol type=\"1\"><li type=\"1\">あいう</li><li type=\"1\">かきく</li></ol></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get030;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_jhtml(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 1);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+char *test_chxj_serf_get031(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+ static char *css = "a:focus { display: none }\n"
+ "a:link { display: none }\n"
+ "a { display: none }\n"
+ "hr { display: none }\n"
+ "a:visited { display:none }\n"
+ "ol { list-style-type: lower-alpha }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jhtml_ol_tag_with_css_002()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><body><ol><li>あいう</li><li>かきく</li></ul></body></html>"
+#define RESULT_STRING "<html><head></head><body><ol type=\"a\"><li type=\"a\">あいう</li><li type=\"a\">かきく</li></ol></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get031;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_jhtml(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 1);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+char *test_chxj_serf_get032(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+ static char *css = "a:focus { display: none }\n"
+ "a:link { display: none }\n"
+ "a { display: none }\n"
+ "hr { display: none }\n"
+ "a:visited { display:none }\n"
+ "ol { list-style-type: upper-alpha }\n";
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_jhtml_ol_tag_with_css_003()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><body><ol><li>あいう</li><li>かきく</li></ul></body></html>"
+#define RESULT_STRING "<html><head></head><body><ol type=\"A\"><li type=\"A\">あいう</li><li type=\"A\">かきく</li></ol></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get032;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_jhtml(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 1);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_jhtml_ol_tag_with_css_004()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><body><ol style=\"list-style-type:decimal\"><li>あいう</li><li>かきく</li></ul></body></html>"
+#define RESULT_STRING "<html><head></head><body><ol type=\"1\"><li type=\"1\">あいう</li><li type=\"1\">かきく</li></ol></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get032;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_jhtml(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 0);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_jhtml_ol_tag_with_css_005()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><body><ol style=\"list-style-type:lower-alpha\"><li>あいう</li><li>かきく</li></ul></body></html>"
+#define RESULT_STRING "<html><head></head><body><ol type=\"a\"><li type=\"a\">あいう</li><li type=\"a\">かきく</li></ol></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get032;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_jhtml(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 0);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_jhtml_ol_tag_with_css_006()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><body><ol style=\"list-style-type:upper-alpha\"><li>あいう</li><li>かきく</li></ul></body></html>"
+#define RESULT_STRING "<html><head></head><body><ol type=\"A\"><li type=\"A\">あいう</li><li type=\"A\">かきく</li></ol></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get032;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_jhtml(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 0);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
/*
* vim:ts=2 et
*/