/*
- * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
+ * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
* Copyright (C) 2005 QSDN,Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
#include "chxj_img_conv.h"
#include "chxj_qr_code.h"
#include "chxj_encoding.h"
+#include "chxj_header_inf.h"
+#include "chxj_conv_z2h.h"
#define GET_CHTML40(X) ((chtml40_t *)(X))
#undef W_L
static char *s_chtml40_end_plaintext_tag (void *pdoc, Node *node);
static char *s_chtml40_newline_mark (void *pdoc, Node *node);
static char *s_chtml40_link_tag (void *pdoc, Node *node);
+static char *s_chtml40_start_span_tag (void *pdoc, Node *node);
+static char *s_chtml40_end_span_tag (void *pdoc, Node *node);
+static char *s_chtml40_style_tag (void *pdoc, Node *node);
static void s_init_chtml40(chtml40_t *chtml, Doc *doc, request_rec *r, device_table *spec);
-static int s_chtml40_search_emoji(chtml40_t *chtml, char *txt, char **rslt);
+static int s_chtml40_search_emoji(chtml40_t *chtml, char *txt, char **rslt, Node *node);
static css_prop_list_t *s_chtml40_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
static css_prop_list_t *s_chtml40_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
s_chtml40_chxjif_tag,
NULL,
},
+ /* tagCHXJRAW */
+ {
+ s_chtml40_chxjif_tag,
+ NULL,
+ },
/* tagNOBR */
{
NULL,
},
/* tagSTYLE */
{
- NULL,
+ s_chtml40_style_tag,
NULL,
},
/* tagSPAN */
{
- NULL,
- NULL,
+ s_chtml40_start_span_tag,
+ s_chtml40_end_span_tag,
},
/* tagTEXT */
{
s_chtml40_newline_mark,
NULL,
},
+ /* tagObject */
+ {
+ NULL,
+ NULL,
+ },
+ /* tagParam */
+ {
+ NULL,
+ NULL,
+ },
+ /* tagCAPTION */
+ {
+ NULL,
+ NULL,
+ },
};
chtml40_t chtml40;
Doc doc;
- DBG(r, "start chxj_convert_chtml40()");
+ DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
/*--------------------------------------------------------------------------*/
/* If qrcode xml */
*dstlen = srclen;
dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
if (dst) {
- DBG(r,"i found qrcode xml");
- DBG(r, "end chxj_convert_chtml40()");
+ DBG(r,"REQ[%X] found qrcode xml",TO_ADDR(r));
+ DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
return dst;
}
- DBG(r,"not found qrcode xml");
/*--------------------------------------------------------------------------*/
/* The CHTML structure is initialized. */
chtml40.entryp = entryp;
chtml40.cookie = cookie;
- chxj_set_content_type(r, "text/html; charset=Windows-31J");
+ chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
/*--------------------------------------------------------------------------*/
/* The character string of the input is analyzed. */
chxj_dump_out("[src] CHTML -> CHTML4.0", dst, *dstlen);
#endif
- DBG(r, "end chxj_convert_chtml40()");
+ DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
return dst;
}
* EMOJI is specified.
* @param rslt [o] The pointer to the pointer that stores the result is
* specified.
+ * @param node [i] The current node to check whether tag is span/font for CHXJ_IMODE_EMOJI_COLOR_AUTO.
* @return When corresponding EMOJI exists, it returns it excluding 0.
*/
static int
-s_chtml40_search_emoji(chtml40_t *chtml40, char *txt, char **rslt)
+s_chtml40_search_emoji(chtml40_t *chtml40, char *txt, char **rslt, Node *node)
{
emoji_t *ee;
request_rec *r;
r = chtml40->doc->r;
if (!spec) {
- DBG(r,"spec is NULL");
+ DBG(r,"REQ[%X] spec is NULL",TO_ADDR(r));
}
for (ee = chtml40->conf->emoji;
(*rslt)[0] = ee->imode->hex1byte & 0xff;
(*rslt)[1] = ee->imode->hex2byte & 0xff;
(*rslt)[2] = 0;
+
+ if(chtml40->conf->imode_emoji_color >= CHXJ_IMODE_EMOJI_COLOR_AUTO ){
+ if(ee->imode->color != NULL){
+ if(chtml40->conf->imode_emoji_color == CHXJ_IMODE_EMOJI_COLOR_AUTO && node != NULL ){
+ if(strcasecmp(node->parent->name, "span") == 0 ||
+ strcasecmp(node->parent->name, "font") == 0 ){
+ return strlen(ee->imode->string);
+ }
+ }
+ char *tmp = apr_pstrdup(r->pool,*rslt);
+ *rslt = apr_psprintf(r->pool,
+ "<font color=\"%s\">%s</font>",ee->imode->color,tmp);
+ }
+ }
return strlen(ee->imode->string);
}
}
+char *
+chxj_chtml40_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
+{
+ apr_size_t ii;
+ Doc __doc;
+ Doc *doc;
+ chtml40_t __chtml40;
+ chtml40_t *chtml40;
+ char one_byte[2];
+ char two_byte[3];
+ apr_pool_t *pool;
+
+ chtml40 = &__chtml40;
+ doc = &__doc;
+
+ DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
+ memset(doc, 0, sizeof(Doc));
+ memset(chtml40, 0, sizeof(chtml40_t));
+
+ doc->r = r;
+ chtml40->doc = doc;
+ chtml40->spec = spec;
+ chtml40->out = qs_alloc_zero_byte_string(r->pool);
+ chtml40->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
+ chtml40->doc->parse_mode = PARSE_MODE_CHTML;
+
+ apr_pool_create(&pool, r->pool);
+
+ chxj_buffered_write_init(pool, &doc->buf);
+
+ for (ii=0; ii<len; ii++) {
+ char *out;
+ int rtn;
+
+ rtn = s_chtml40_search_emoji(chtml40, (char *)&src[ii], &out, NULL);
+ if (rtn) {
+ W_V(out);
+ ii+=(rtn - 1);
+ continue;
+ }
+
+ if (is_sjis_kanji(src[ii])) {
+ two_byte[0] = src[ii+0];
+ two_byte[1] = src[ii+1];
+ two_byte[2] = 0;
+ W_V(two_byte);
+ ii++;
+ }
+ else {
+ one_byte[0] = src[ii+0];
+ one_byte[1] = 0;
+ W_V(one_byte);
+ }
+ }
+ chtml40->out = chxj_buffered_write_flush(chtml40->out, &doc->buf);
+
+ DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
+ return chtml40->out;
+}
+
+
/**
* It is a handler who processes the HTML tag.
*
if (content_type_flag) {
W_L(" ");
W_V(name);
- W_L("=\"text/html; charset=Windows-31J\"");
+ W_L("=\"");
+ W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
+ W_L("\"");
}
else
if (refresh_flag) {
sec = apr_pstrdup(r->pool, buf);
sec[url-buf] = 0;
url++;
- url = chxj_encoding_parameter(r, url);
+ url = chxj_encoding_parameter(r, url, 0);
url = chxj_add_cookie_parameter(r, url, chtml40->cookie);
W_L(" ");
W_V(name);
/*----------------------------------------------------------------------*/
/* CHTML1.0 */
/*----------------------------------------------------------------------*/
- value = chxj_encoding_parameter(r, value);
- value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
+ value = chxj_encoding_parameter(r, value, 0);
+ if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
+ value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
+ }
W_L(" href=\"");
W_V(value);
W_L("\"");
}
}
}
+
+ int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
+
W_L("<form");
if (attr_action) {
- attr_action = chxj_encoding_parameter(r, attr_action);
+ attr_action = chxj_encoding_parameter(r, attr_action, 0);
attr_action = chxj_add_cookie_parameter(r, attr_action, chtml40->cookie);
char *q;
+ char *new_query_string = NULL;
q = strchr(attr_action, '?');
if (q) {
- new_hidden_tag = chxj_form_action_to_hidden_tag(doc->pool, attr_action, 0);
- *q = 0;
+ new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &new_query_string, CHXJ_TRUE, CHXJ_FALSE, chtml40->entryp);
+ if (new_hidden_tag || new_query_string) {
+ *q = 0;
+ }
}
W_L(" action=\"");
W_V(attr_action);
+ if (new_query_string) {
+ W_L("?");
+ W_V(new_query_string);
+ }
W_L("\"");
}
if (attr_method) {
W_L("\"");
}
if (attr_value) {
+ if (attr_type && (STRCASEEQ('s','S',"submit",attr_type) || STRCASEEQ('r','R',"reset",attr_type))) {
+ apr_size_t value_len = strlen(attr_value);
+ attr_value = chxj_conv_z2h(r, attr_value, &value_len, chtml40->entryp);
+ }
+
W_L(" value=\"");
W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
W_L("\"");
/* CHTML 1.0 */
/*--------------------------------------------------------------------*/
#ifdef IMG_NOT_CONVERT_FILENAME
- value = chxj_encoding_parameter(r, value);
- value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
- if (value) {
- value = apr_psprintf(doc->buf.pool,
- "%s%c%s=true",
- value,
- (strchr(value, '?')) ? '&' : '?',
- CHXJ_COOKIE_NOUPDATE_PARAM);
- }
- attr_src = value;
+ value = chxj_encoding_parameter(r, value, 0);
+ value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
+ value = chxj_add_cookie_no_update_parameter(r, value);
+ value = chxj_img_rewrite_parameter(r,chtml40->conf,value);
+ attr_src = value;
#else
- value = chxj_img_conv(r, spec, value);
- value = chxj_encoding_parameter(r, value);
- value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
- if (value) {
- value = apr_psprintf(doc->buf.pool,
- "%s%c%s=true",
- value,
- (strchr(value, '?')) ? '&' : '?',
- CHXJ_COOKIE_NOUPDATE_PARAM);
- }
- attr_src = value;
+ value = chxj_img_conv(r,spec,value);
+ value = chxj_encoding_parameter(r, value, 0);
+ value = chxj_add_cookie_parameter(r, value, chtml40->cookie);
+ value = chxj_add_cookie_no_update_parameter(r, value);
+ value = chxj_img_rewrite_parameter(r,chtml40->conf,value);
+ attr_src = value;
#endif
}
else if (strcasecmp(name,"style") == 0 && value && *value) {
value = apr_pstrdup(doc->buf.pool, val);
}
}
- if (value && *value) {
+ if (value) {
W_L(" value=\"");
W_V(value);
W_L("\"");
char *attr_wap_marquee_dir = NULL;
char *attr_wap_marquee_loop = NULL;
char *attr_color = NULL;
+ char *attr_bgcolor = NULL;
chtml40 = GET_CHTML40(pdoc);
doc = chtml40->doc;
css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
+ css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
+ css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
css_property_t *cur;
for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
}
for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
attr_color = apr_pstrdup(doc->pool, cur->value);
+ attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+ }
+ for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
+ attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+ attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+ }
+ for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
+ char *ss = strchr(cur->value, '#');
+ if (!ss) {
+ ss = strstr(cur->value, "rgb");
+ }
+ if (ss) {
+ attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+ attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+ }
}
for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
attr_align = apr_pstrdup(doc->pool, cur->value);
W_L(">");
flg->with_div_flag = 1;
}
+ else {
+ W_L("<div>");
+ flg->with_div_flag = 1;
+ }
if (attr_color) {
- W_L("<font color=\"");
- W_V(attr_color);
- W_L("\">");
- flg->with_font_flag = 1;
+ if (attr_bgcolor && (STRCASEEQ('w','W',"white",attr_color) || STRCASEEQ('#','#',"#ffffff",attr_color))) {
+ /* nothing */
+ }
+ else {
+ W_L("<font color=\"");
+ W_V(attr_color);
+ W_L("\">");
+ flg->with_font_flag = 1;
+ }
}
if (attr_decoration) {
W_L("<blink>");
char one_byte[2];
int ii;
int tdst_len;
+ apr_size_t z2h_input_len;
chtml40 = GET_CHTML40(pdoc);
doc = chtml40->doc;
for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
char* out;
- int rtn = s_chtml40_search_emoji(chtml40, &textval[ii], &out);
+ int rtn = s_chtml40_search_emoji(chtml40, &textval[ii], &out, child);
if (rtn) {
tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
ii+=(rtn - 1);
tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
}
}
+ z2h_input_len = strlen(tdst);
+ tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, chtml40->entryp);
W_V(tdst);
return chtml40->out;
}
chtml40_t *chtml40 = GET_CHTML40(pdoc);
Doc *doc = chtml40->doc;
Attr *attr;
- W_L("<marquee");
+ char *attr_direction = NULL;
+ char *attr_behavior = NULL;
+ char *attr_loop = NULL;
+ char *attr_style = NULL;
+ char *attr_color = NULL;
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
char *value = qs_get_attr_value(doc,attr);
if (STRCASEEQ('d','D',"direction", name)) {
if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
- W_L(" direction=\"");
- W_V(value);
- W_L("\"");
+ attr_direction = value;
}
}
else if (STRCASEEQ('b','B',"behavior",name)) {
if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
- W_L(" behavior=\"");
- W_V(value);
- W_L("\"");
+ attr_behavior = value;
}
}
else if (STRCASEEQ('l','L',"loop",name)) {
if (value && *value) {
- W_L(" loop=\"");
- W_V(value);
- W_L("\"");
+ attr_loop = value;
}
}
+ else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+ attr_style = value;
+ }
+ }
+ if (IS_CSS_ON(chtml40->entryp)) {
+ css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
+ if (style) {
+ css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+ css_property_t *direction_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
+ css_property_t *style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
+ css_property_t *loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
+ css_property_t *cur;
+ for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ attr_color = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ for (cur = style_prop->next; cur != style_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ attr_behavior = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ attr_loop = apr_pstrdup(doc->pool, cur->value);
+ if (STRCASEEQ('i','I',"infinite",attr_loop)) {
+ attr_loop = "16";
+ }
+ }
+ }
+ for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if (STRCASEEQ('l','L',"ltr",cur->value)) {
+ attr_direction = "right";
+ }
+ else if (STRCASEEQ('r','R',"rtl",cur->value)) {
+ attr_direction = "left";
+ }
+ }
+ }
+ }
+ }
+ W_L("<marquee");
+ if (attr_direction) {
+ W_L(" direction=\"");
+ W_V(attr_direction);
+ W_L("\"");
+ }
+ if (attr_behavior) {
+ W_L(" behavior=\"");
+ W_V(attr_behavior);
+ W_L("\"");
+ }
+ if (attr_loop) {
+ W_L(" loop=\"");
+ W_V(attr_loop);
+ W_L("\"");
}
W_L(">");
+
+ chtml40_flags_t *flg = (chtml40_flags_t *)apr_palloc(doc->pool, sizeof(chtml40_flags_t));
+ memset(flg, 0, sizeof(*flg));
+ if (attr_color) {
+ attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+ W_L("<font color=\"");
+ W_V(attr_color);
+ W_L("\">");
+ flg->with_font_flag = 1;
+ }
+ node->userData = (void *)flg;
return chtml40->out;
}
* @return The conversion result is returned.
*/
static char *
-s_chtml40_end_marquee_tag(void *pdoc, Node *UNUSED(child))
+s_chtml40_end_marquee_tag(void *pdoc, Node *node)
{
chtml40_t *chtml40 = GET_CHTML40(pdoc);
- Doc *doc = chtml40->doc;
+ Doc *doc = chtml40->doc;
+ chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
+ if (flg && flg->with_font_flag) {
+ W_L("</font>");
+ }
W_L("</marquee>");
+ if (IS_CSS_ON(chtml40->entryp)) {
+ chxj_css_pop_prop_list(chtml40->css_prop_stack);
+ }
return chtml40->out;
}
}
if (rel && href && type) {
- DBG(doc->r, "start load CSS. url:[%s]", href);
+ DBG(doc->r, "REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
chtml40->style = chxj_css_parse_from_uri(doc->r, doc->pool, chtml40->style, href);
- DBG(doc->r, "end load CSS. url:[%s]", href);
+ DBG(doc->r, "REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
}
return chtml40->out;
}
return last_css;
}
+
+
+
+/**
+ * It is a handler who processes the SPAN tag.
+ *
+ * @param pdoc [i/o] The pointer to the CHTML structure at the output
+ * destination is specified.
+ * @param node [i] The SPAN tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml40_start_span_tag(void *pdoc, Node *node)
+{
+ chtml40_t *chtml40;
+ Doc *doc;
+ Attr *attr;
+ char *attr_style = NULL;
+ char *attr_color = NULL;
+ char *attr_align = NULL;
+ char *attr_blink = NULL;
+ char *attr_marquee = NULL;
+ char *attr_marquee_dir = NULL;
+ char *attr_marquee_style = NULL;
+ char *attr_marquee_loop = NULL;
+
+ chtml40 = GET_CHTML40(pdoc);
+ doc = chtml40->doc;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *nm = qs_get_attr_name(doc,attr);
+ char *val = qs_get_attr_value(doc,attr);
+ if (val && STRCASEEQ('s','S',"style", nm)) {
+ attr_style = val;
+ }
+ }
+ if (IS_CSS_ON(chtml40->entryp)) {
+ css_prop_list_t *style = s_chtml40_push_and_get_now_style(pdoc, node, attr_style);
+ if (style) {
+ css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+ css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
+ css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
+ css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
+ css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
+ css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
+ css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
+ css_property_t *cur;
+ for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+ attr_color = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
+ if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
+ attr_blink = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+ if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
+ attr_marquee = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if (STRCASEEQ('l','L',"ltr",cur->value)) {
+ attr_marquee_dir = "right";
+ }
+ else if (STRCASEEQ('r','R',"rtl",cur->value)) {
+ attr_marquee_dir = "left";
+ }
+ }
+ }
+ for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if ( STRCASEEQ('s','S',"scroll",cur->value)
+ || STRCASEEQ('s','S',"slide",cur->value)
+ || STRCASEEQ('a','A',"alternate",cur->value)) {
+ attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ }
+ for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
+ if (cur->value && *cur->value) {
+ if (STRCASEEQ('i','I',"infinite",cur->value)) {
+ attr_marquee_loop = "16";
+ }
+ else {
+ attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ }
+ for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
+ if (STRCASEEQ('l','L',"left", cur->value)) {
+ attr_align = apr_pstrdup(doc->pool, "left");
+ }
+ else if (STRCASEEQ('c','C',"center",cur->value)) {
+ attr_align = apr_pstrdup(doc->pool, "center");
+ }
+ else if (STRCASEEQ('r','R',"right",cur->value)) {
+ attr_align = apr_pstrdup(doc->pool, "right");
+ }
+ }
+ }
+ }
+ if (attr_color || attr_align || attr_blink || attr_marquee) {
+ chtml40_flags_t *flg = apr_palloc(doc->pool, sizeof(*flg));
+ memset(flg, 0, sizeof(*flg));
+ if (attr_blink) {
+ W_L("<blink>");
+ flg->with_blink_flag = 1;
+ }
+ if (attr_marquee) {
+ W_L("<marquee");
+ if (attr_marquee_dir) {
+ W_L(" direction=\"");
+ W_V(attr_marquee_dir);
+ W_L("\"");
+ }
+ if (attr_marquee_style) {
+ W_L(" behavior=\"");
+ W_V(attr_marquee_style);
+ W_L("\"");
+ }
+ if (attr_marquee_loop) {
+ W_L(" loop=\"");
+ W_V(attr_marquee_loop);
+ W_L("\"");
+ }
+ W_L(">");
+ flg->with_marquee_flag = 1;
+ }
+ if (attr_color) {
+ attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+ W_L("<font color=\"");
+ W_V(attr_color);
+ W_L("\">");
+ flg->with_font_flag = 1;
+ }
+ if (attr_align) {
+ W_L("<div align=\"");
+ W_V(attr_align);
+ W_L("\">");
+ flg->with_div_flag = 1;
+ }
+ node->userData = flg;
+ }
+ else {
+ node->userData = NULL;
+ }
+ return chtml40->out;
+}
+
+
+/**
+ * It is a handler who processes the SPAN tag.
+ *
+ * @param pdoc [i/o] The pointer to the CHTML structure at the output
+ * destination is specified.
+ * @param node [i] The SPAN tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml40_end_span_tag(void *pdoc, Node *node)
+{
+ chtml40_t *chtml40 = GET_CHTML40(pdoc);
+ Doc *doc = chtml40->doc;
+
+ chtml40_flags_t *flg = (chtml40_flags_t *)node->userData;
+ if (flg && flg->with_div_flag) {
+ W_L("</div>");
+ }
+ if (flg && flg->with_font_flag) {
+ W_L("</font>");
+ }
+ if (flg && flg->with_marquee_flag) {
+ W_L("</marquee>");
+ }
+ if (flg && flg->with_blink_flag) {
+ W_L("</blink>");
+ }
+ if (IS_CSS_ON(chtml40->entryp)) {
+ chxj_css_pop_prop_list(chtml40->css_prop_stack);
+ }
+ return chtml40->out;
+}
+
+
+/**
+ * It is a handler who processes the STYLE tag.
+ *
+ * @param pdoc [i/o] The pointer to the CHTML structure at the output
+ * destination is specified.
+ * @param node [i] The STYLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_chtml40_style_tag(void *pdoc, Node *node)
+{
+ chtml40_t *chtml40;
+ Doc *doc;
+ Attr *attr;
+ char *type = NULL;
+
+ chtml40 = GET_CHTML40(pdoc);
+ doc = chtml40->doc;
+
+ if (! IS_CSS_ON(chtml40->entryp)) {
+ return chtml40->out;
+ }
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('t','T',"type", name)) {
+ if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
+ type = value;
+ }
+ }
+ }
+
+ Node *child = qs_get_child_node(doc, node);
+ if (type && child) {
+ char *name = qs_get_node_name(doc, child);
+ if (STRCASEEQ('t','T',"text", name)) {
+ char *value = qs_get_node_value(doc, child);
+ DBG(doc->r, "REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),value);
+ chtml40->style = chxj_css_parse_style_value(doc, chtml40->style, value);
+ DBG(doc->r, "REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),value);
+ }
+ }
+ return chtml40->out;
+}
/*
* vim:ts=2 et
*/