2 * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_jhtml.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
27 #include "chxj_serf.h"
28 #include "chxj_conv_z2h.h"
31 #define GET_JHTML(X) ((jhtml_t *)(X))
34 #define W_L(X) do { jhtml->out = BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, (X)); } while(0)
35 #define W_V(X) do { jhtml->out = (X) ? BUFFERED_WRITE_VALUE(jhtml->out, &doc->buf, (X)) \
36 : BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, ""); } while(0)
38 #define W_NLCODE() do { char *nlcode = TO_NLCODE(jhtml->conf); W_V(nlcode); } while (0)
40 static char *s_jhtml_start_html_tag (void *pdoc, Node *node);
41 static char *s_jhtml_end_html_tag (void *pdoc, Node *node);
42 static char *s_jhtml_start_meta_tag (void *pdoc, Node *node);
43 static char *s_jhtml_end_meta_tag (void *pdoc, Node *node);
44 static char *s_jhtml_start_head_tag (void *pdoc, Node *node);
45 static char *s_jhtml_end_head_tag (void *pdoc, Node *node);
46 static char *s_jhtml_start_title_tag (void *pdoc, Node *node);
47 static char *s_jhtml_end_title_tag (void *pdoc, Node *node);
48 static char *s_jhtml_start_base_tag (void *pdoc, Node *node);
49 static char *s_jhtml_end_base_tag (void *pdoc, Node *node);
50 static char *s_jhtml_start_body_tag (void *pdoc, Node *node);
51 static char *s_jhtml_end_body_tag (void *pdoc, Node *node);
52 static char *s_jhtml_start_a_tag (void *pdoc, Node *node);
53 static char *s_jhtml_end_a_tag (void *pdoc, Node *node);
54 static char *s_jhtml_start_pre_tag (void *pdoc, Node *node);
55 static char *s_jhtml_end_pre_tag (void *pdoc, Node *node);
56 static char *s_jhtml_start_p_tag (void *pdoc, Node *node);
57 static char *s_jhtml_end_p_tag (void *pdoc, Node *node);
58 static char *s_jhtml_start_ul_tag (void *pdoc, Node *node);
59 static char *s_jhtml_end_ul_tag (void *pdoc, Node *node);
60 static char *s_jhtml_start_ol_tag (void *pdoc, Node *node);
61 static char *s_jhtml_end_ol_tag (void *pdoc, Node *node);
62 static char *s_jhtml_start_li_tag (void *pdoc, Node *node);
63 static char *s_jhtml_end_li_tag (void *pdoc, Node *node);
64 static char *s_jhtml_start_br_tag (void *pdoc, Node *node);
65 static char *s_jhtml_end_br_tag (void *pdoc, Node *node);
66 static char *s_jhtml_start_tr_tag (void *pdoc, Node *node);
67 static char *s_jhtml_end_tr_tag (void *pdoc, Node *node);
68 static char *s_jhtml_start_font_tag (void *pdoc, Node *node);
69 static char *s_jhtml_end_font_tag (void *pdoc, Node *node);
70 static char *s_jhtml_start_form_tag (void *pdoc, Node *node);
71 static char *s_jhtml_end_form_tag (void *pdoc, Node *node);
72 static char *s_jhtml_start_input_tag (void *pdoc, Node *node);
73 static char *s_jhtml_end_input_tag (void *pdoc, Node *node);
74 static char *s_jhtml_start_center_tag (void *pdoc, Node *node);
75 static char *s_jhtml_end_center_tag (void *pdoc, Node *node);
76 static char *s_jhtml_start_hr_tag (void *pdoc, Node *node);
77 static char *s_jhtml_end_hr_tag (void *pdoc, Node *node);
78 static char *s_jhtml_start_img_tag (void *pdoc, Node *node);
79 static char *s_jhtml_end_img_tag (void *pdoc, Node *node);
80 static char *s_jhtml_start_select_tag (void *pdoc, Node *node);
81 static char *s_jhtml_end_select_tag (void *pdoc, Node *node);
82 static char *s_jhtml_start_option_tag (void *pdoc, Node *node);
83 static char *s_jhtml_end_option_tag (void *pdoc, Node *node);
84 static char *s_jhtml_start_div_tag (void *pdoc, Node *node);
85 static char *s_jhtml_end_div_tag (void *pdoc, Node *node);
86 static char *s_jhtml_start_textarea_tag (void *pdoc, Node *node);
87 static char *s_jhtml_end_textarea_tag (void *pdoc, Node *node);
88 static char *s_jhtml_start_b_tag (void *pdoc, Node *node);
89 static char *s_jhtml_end_b_tag (void *pdoc, Node *node);
90 static char *s_jhtml_chxjif_tag (void *pdoc, Node *node);
91 static char *s_jhtml_text_tag (void *pdoc, Node *node);
92 static char *s_jhtml_start_blockquote_tag(void *pdoc, Node *node);
93 static char *s_jhtml_end_blockquote_tag (void *pdoc, Node *node);
94 static char *s_jhtml_start_dir_tag (void *pdoc, Node *node);
95 static char *s_jhtml_end_dir_tag (void *pdoc, Node *node);
96 static char *s_jhtml_start_dl_tag (void *pdoc, Node *node);
97 static char *s_jhtml_end_dl_tag (void *pdoc, Node *node);
98 static char *s_jhtml_start_dt_tag (void *pdoc, Node *node);
99 static char *s_jhtml_end_dt_tag (void *pdoc, Node *node);
100 static char *s_jhtml_start_dd_tag (void *pdoc, Node *node);
101 static char *s_jhtml_end_dd_tag (void *pdoc, Node *node);
102 static char *s_jhtml_start_h1_tag (void *pdoc, Node *node);
103 static char *s_jhtml_end_h1_tag (void *pdoc, Node *node);
104 static char *s_jhtml_start_h2_tag (void *pdoc, Node *node);
105 static char *s_jhtml_end_h2_tag (void *pdoc, Node *node);
106 static char *s_jhtml_start_h3_tag (void *pdoc, Node *node);
107 static char *s_jhtml_end_h3_tag (void *pdoc, Node *node);
108 static char *s_jhtml_start_h4_tag (void *pdoc, Node *node);
109 static char *s_jhtml_end_h4_tag (void *pdoc, Node *node);
110 static char *s_jhtml_start_h5_tag (void *pdoc, Node *node);
111 static char *s_jhtml_end_h5_tag (void *pdoc, Node *node);
112 static char *s_jhtml_start_h6_tag (void *pdoc, Node *node);
113 static char *s_jhtml_end_h6_tag (void *pdoc, Node *node);
114 static char *s_jhtml_start_menu_tag (void *pdoc, Node *node);
115 static char *s_jhtml_end_menu_tag (void *pdoc, Node *node);
116 static char *s_jhtml_start_plaintext_tag (void *pdoc, Node *node);
117 static char *s_jhtml_start_plaintext_tag_inner (void *pdoc, Node *node);
118 static char *s_jhtml_end_plaintext_tag (void *pdoc, Node *node);
119 static char *s_jhtml_start_blink_tag (void *pdoc, Node *node);
120 static char *s_jhtml_end_blink_tag (void *pdoc, Node *node);
121 static char *s_jhtml_start_marquee_tag(void *pdoc, Node *node);
122 static char *s_jhtml_end_marquee_tag (void *pdoc, Node *node);
123 static char *s_jhtml_newline_mark (void *pdoc, Node *node);
125 static void s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec);
127 static int s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt);
129 static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
131 static char *s_add_copyright_parameter(request_rec *r, char *value);
134 tag_handler jhtml_handler[] = {
137 s_jhtml_start_html_tag,
138 s_jhtml_end_html_tag,
142 s_jhtml_start_meta_tag,
143 s_jhtml_end_meta_tag,
147 s_jhtml_start_textarea_tag,
148 s_jhtml_end_textarea_tag,
157 s_jhtml_start_pre_tag,
162 s_jhtml_start_ul_tag,
167 s_jhtml_start_li_tag,
172 s_jhtml_start_ol_tag,
177 s_jhtml_start_h1_tag,
182 s_jhtml_start_h2_tag,
187 s_jhtml_start_h3_tag,
192 s_jhtml_start_h4_tag,
197 s_jhtml_start_h5_tag,
202 s_jhtml_start_h6_tag,
207 s_jhtml_start_head_tag,
208 s_jhtml_end_head_tag,
212 s_jhtml_start_title_tag,
213 s_jhtml_end_title_tag,
217 s_jhtml_start_base_tag,
218 s_jhtml_end_base_tag,
222 s_jhtml_start_body_tag,
223 s_jhtml_end_body_tag,
232 s_jhtml_start_br_tag,
242 s_jhtml_start_tr_tag,
257 s_jhtml_start_font_tag,
258 s_jhtml_end_font_tag,
262 s_jhtml_start_form_tag,
263 s_jhtml_end_form_tag,
267 s_jhtml_start_input_tag,
268 s_jhtml_end_input_tag,
272 s_jhtml_start_center_tag,
273 s_jhtml_end_center_tag,
277 s_jhtml_start_hr_tag,
282 s_jhtml_start_img_tag,
287 s_jhtml_start_select_tag,
288 s_jhtml_end_select_tag,
292 s_jhtml_start_option_tag,
293 s_jhtml_end_option_tag,
297 s_jhtml_start_div_tag,
352 s_jhtml_start_dt_tag,
367 s_jhtml_start_blockquote_tag,
368 s_jhtml_end_blockquote_tag,
372 s_jhtml_start_dir_tag,
377 s_jhtml_start_dl_tag,
382 s_jhtml_start_dd_tag,
387 s_jhtml_start_menu_tag,
388 s_jhtml_end_menu_tag,
392 s_jhtml_start_plaintext_tag,
393 s_jhtml_end_plaintext_tag,
397 s_jhtml_start_blink_tag,
398 s_jhtml_end_blink_tag,
402 s_jhtml_start_marquee_tag,
403 s_jhtml_end_marquee_tag,
407 s_jhtml_newline_mark,
414 * converts from CHTML5.0 to JHTML.
416 * @param r [i] Requet_rec is appointed.
417 * @param spec [i] The result of the device specification processing which
418 * was done in advance is appointed.
419 * @param src [i] The character string before the converting is appointed.
420 * @return The character string after the converting is returned.
429 chxjconvrule_entry *entryp,
441 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
442 /*--------------------------------------------------------------------------*/
444 /*--------------------------------------------------------------------------*/
446 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
448 DBG(r,"REQ[%X] found qrcode xml",TO_ADDR(r));
449 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
453 /*--------------------------------------------------------------------------*/
454 /* The CHTML structure is initialized. */
455 /*--------------------------------------------------------------------------*/
456 s_init_jhtml(&jhtml, &doc, r, spec);
458 jhtml.entryp = entryp;
459 jhtml.cookie = cookie;
461 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
463 /*--------------------------------------------------------------------------*/
464 /* The character string of the input is analyzed. */
465 /*--------------------------------------------------------------------------*/
466 qs_init_malloc(&doc);
467 qs_init_root_node(&doc);
469 apr_pool_create(&pool, r->pool);
470 ss = apr_pcalloc(pool, srclen + 1);
472 memset(ss, 0, srclen + 1);
473 memcpy(ss, src, srclen);
476 chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
479 qs_parse_string(&doc,ss,strlen(ss));
481 chxj_buffered_write_init(r->pool, &doc.buf);
482 /*--------------------------------------------------------------------------*/
483 /* It converts it from CHTML to JHTML. */
484 /*--------------------------------------------------------------------------*/
485 chxj_node_convert(spec,r,(void*)&jhtml, &doc, qs_get_root(&doc), 0);
486 jhtml.out = chxj_buffered_write_flush(jhtml.out, &doc.buf);
487 dst = apr_pstrdup(pool, jhtml.out);
488 chxj_buffered_write_terminate(&doc.buf);
491 qs_all_free(&doc,QX_LOGMARK);
494 return apr_pstrdup(pool,ss);
497 dst = apr_psprintf(pool, "\n");
499 *dstlen = strlen(dst);
502 chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
510 * The CHTML structure is initialized.
512 * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
513 * initialized is specified.
514 * @param doc [i] The Doc structure that should be set to the initialized
515 * JHTML structure is specified.
516 * @param r [i] To use POOL, the pointer to request_rec is specified.
517 * @param spec [i] The pointer to the device_table
520 s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec)
522 memset(doc, 0, sizeof(Doc));
523 memset(jhtml, 0, sizeof(jhtml_t));
528 jhtml->out = qs_alloc_zero_byte_string(r->pool);
529 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
530 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
535 * Corresponding EMOJI to a current character-code is retrieved.
536 * The substitution character string is stored in the rslt pointer if agreeing.
538 * @param jhtml [i] The pointer to the CHTML structure is specified.
539 * @param txt [i] The character string to want to examine whether it is
540 * EMOJI is specified.
541 * @param rslt [o] The pointer to the pointer that stores the result is
543 * @return When corresponding EMOJI exists, it returns it excluding 0.
546 s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt)
558 if (! spec) DBG(r,"REQ[%X] spec is NULL",TO_ADDR(r));
560 for (ee = jhtml->conf->emoji;
564 unsigned char hex1byte;
565 unsigned char hex2byte;
568 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
572 hex1byte = ee->imode->hex1byte & 0xff;
573 hex2byte = ee->imode->hex2byte & 0xff;
575 if (ee->imode->string
576 && strlen(ee->imode->string) > 0
577 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
578 if (spec == NULL || spec->emoji_type == NULL) {
579 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
580 return strlen(ee->imode->string);
587 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
588 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
589 if (spec == NULL || spec->emoji_type == NULL) {
590 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
603 chxj_jhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
617 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
618 memset(doc, 0, sizeof(Doc));
619 memset(jhtml, 0, sizeof(jhtml_t));
624 jhtml->out = qs_alloc_zero_byte_string(r->pool);
625 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
626 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
628 apr_pool_create(&pool, r->pool);
630 chxj_buffered_write_init(pool, &doc->buf);
632 for (ii=0; ii<len; ii++) {
636 rtn = s_jhtml_search_emoji(jhtml, (char *)&src[ii], &out);
643 if (is_sjis_kanji(src[ii])) {
644 two_byte[0] = src[ii+0];
645 two_byte[1] = src[ii+1];
651 one_byte[0] = src[ii+0];
656 jhtml->out = chxj_buffered_write_flush(jhtml->out, &doc->buf);
658 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
664 * It is a handler who processes the HTML tag.
666 * @param pdoc [i/o] The pointer to the CHTML structure at the output
667 * destination is specified.
668 * @param node [i] The HTML tag node is specified.
669 * @return The conversion result is returned.
672 s_jhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
679 jhtml = GET_JHTML(pdoc);
682 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
684 /*--------------------------------------------------------------------------*/
686 /*--------------------------------------------------------------------------*/
689 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
696 * It is a handler who processes the HTML tag.
698 * @param pdoc [i/o] The pointer to the CHTML structure at the output
699 * destination is specified.
700 * @param node [i] The HTML tag node is specified.
701 * @return The conversion result is returned.
704 s_jhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
706 jhtml_t *jhtml = GET_JHTML(pdoc);
707 Doc *doc = jhtml->doc;
716 * It is a handler who processes the META tag.
718 * @param pdoc [i/o] The pointer to the CHTML structure at the output
719 * destination is specified.
720 * @param node [i] The META tag node is specified.
721 * @return The conversion result is returned.
724 s_jhtml_start_meta_tag(void *pdoc, Node *node)
730 int content_type_flag;
733 jhtml = GET_JHTML(pdoc);
737 content_type_flag = 0;
740 /*--------------------------------------------------------------------------*/
742 /*--------------------------------------------------------------------------*/
743 for (attr = qs_get_attr(doc,node);
745 attr = qs_get_next_attr(doc,attr)) {
746 char *name = qs_get_attr_name(doc,attr);
747 char *value = qs_get_attr_value(doc,attr);
751 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
752 /*----------------------------------------------------------------------*/
754 /*----------------------------------------------------------------------*/
755 W_L(" http-equiv=\"");
758 if (STRCASEEQ('c','C',"content-type",value)) {
759 content_type_flag = 1;
761 if (STRCASEEQ('r','R',"refresh",value)) {
769 if (strcasecmp(name, "content") == 0 && value && *value) {
770 /*----------------------------------------------------------------------*/
772 /*----------------------------------------------------------------------*/
773 if (content_type_flag) {
777 W_V(chxj_header_inf_set_content_type(r, "text/html; charset=SHIFT_JIS"));
786 buf = apr_pstrdup(r->pool, value);
788 url = strchr(buf, ';');
790 sec = apr_pstrdup(r->pool, buf);
793 url = chxj_encoding_parameter(r, url);
794 url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
824 * It is a handler who processes the META tag.
826 * @param pdoc [i/o] The pointer to the CHTML structure at the output
827 * destination is specified.
828 * @param node [i] The META tag node is specified.
829 * @return The conversion result is returned.
832 s_jhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
834 jhtml_t *jhtml = GET_JHTML(pdoc);
841 * It is a handler who processes the HEAD tag.
843 * @param pdoc [i/o] The pointer to the CHTML structure at the output
844 * destination is specified.
845 * @param node [i] The HEAD tag node is specified.
846 * @return The conversion result is returned.
849 s_jhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
855 jhtml = GET_JHTML(pdoc);
865 * It is a handler who processes the HEAD tag.
867 * @param pdoc [i/o] The pointer to the CHTML structure at the output
868 * destination is specified.
869 * @param node [i] The HEAD tag node is specified.
870 * @return The conversion result is returned.
873 s_jhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
879 jhtml = GET_JHTML(pdoc);
889 * It is a handler who processes the TITLE tag.
891 * @param pdoc [i/o] The pointer to the CHTML structure at the output
892 * destination is specified.
893 * @param node [i] The TITLE tag node is specified.
894 * @return The conversion result is returned.
897 s_jhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
903 jhtml = GET_JHTML(pdoc);
913 * It is a handler who processes the TITLE tag.
915 * @param pdoc [i/o] The pointer to the CHTML structure at the output
916 * destination is specified.
917 * @param node [i] The TITLE tag node is specified.
918 * @return The conversion result is returned.
921 s_jhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
927 jhtml = GET_JHTML(pdoc);
937 * It is a handler who processes the BASE tag.
939 * @param pdoc [i/o] The pointer to the CHTML structure at the output
940 * destination is specified.
941 * @param node [i] The BASE tag node is specified.
942 * @return The conversion result is returned.
945 s_jhtml_start_base_tag(void *pdoc, Node *node)
952 jhtml = GET_JHTML(pdoc);
957 /*--------------------------------------------------------------------------*/
959 /*--------------------------------------------------------------------------*/
960 for (attr = qs_get_attr(doc,node);
962 attr = qs_get_next_attr(doc,attr)) {
963 char *name = qs_get_attr_name(doc,attr);
964 char *value = qs_get_attr_value(doc,attr);
965 if (STRCASEEQ('h','H',"href",name)) {
977 * It is a handler who processes the BASE tag.
979 * @param pdoc [i/o] The pointer to the CHTML structure at the output
980 * destination is specified.
981 * @param node [i] The BASE tag node is specified.
982 * @return The conversion result is returned.
985 s_jhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
987 jhtml_t *jhtml = GET_JHTML(pdoc);
993 * It is a handler who processes the BODY tag.
995 * @param pdoc [i/o] The pointer to the CHTML structure at the output
996 * destination is specified.
997 * @param node [i] The BODY tag node is specified.
998 * @return The conversion result is returned.
1001 s_jhtml_start_body_tag(void *pdoc, Node *node)
1008 jhtml = GET_JHTML(pdoc);
1013 /*--------------------------------------------------------------------------*/
1014 /* Get Attributes */
1015 /*--------------------------------------------------------------------------*/
1016 for (attr = qs_get_attr(doc,node);
1018 attr = qs_get_next_attr(doc,attr)) {
1019 char *name = qs_get_attr_name(doc,attr);
1020 char *value = qs_get_attr_value(doc,attr);
1021 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1022 /*----------------------------------------------------------------------*/
1024 /*----------------------------------------------------------------------*/
1029 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1030 /*----------------------------------------------------------------------*/
1032 /*----------------------------------------------------------------------*/
1037 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1038 /*----------------------------------------------------------------------*/
1040 /*----------------------------------------------------------------------*/
1045 else if (STRCASEEQ('a','A',"alink",name)) {
1046 /*----------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------*/
1051 else if (STRCASEEQ('v','V',"vlink",name)) {
1052 /*----------------------------------------------------------------------*/
1054 /*----------------------------------------------------------------------*/
1064 * It is a handler who processes the BODY tag.
1066 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1067 * destination is specified.
1068 * @param node [i] The BODY tag node is specified.
1069 * @return The conversion result is returned.
1072 s_jhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
1078 jhtml = GET_JHTML(pdoc);
1088 * It is a handler who processes the A tag.
1090 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1091 * destination is specified.
1092 * @param node [i] The A tag node is specified.
1093 * @return The conversion result is returned.
1096 s_jhtml_start_a_tag(void *pdoc, Node *node)
1103 jhtml = GET_JHTML(pdoc);
1108 /*--------------------------------------------------------------------------*/
1109 /* Get Attributes */
1110 /*--------------------------------------------------------------------------*/
1111 for (attr = qs_get_attr(doc,node);
1113 attr = qs_get_next_attr(doc,attr)) {
1114 char *name = qs_get_attr_name(doc,attr);
1115 char *value = qs_get_attr_value(doc,attr);
1116 if (STRCASEEQ('n','N',"name",name)) {
1117 /*----------------------------------------------------------------------*/
1119 /*----------------------------------------------------------------------*/
1124 else if (STRCASEEQ('h','H',"href",name)) {
1125 /*----------------------------------------------------------------------*/
1127 /*----------------------------------------------------------------------*/
1128 value = chxj_encoding_parameter(r, value);
1129 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1130 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1131 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp);
1137 else if (STRCASEEQ('a','A',"accesskey",name)) {
1138 /*----------------------------------------------------------------------*/
1140 /*----------------------------------------------------------------------*/
1141 W_L(" accesskey=\"");
1145 else if (STRCASEEQ('c','C',"cti",name)) {
1146 /*----------------------------------------------------------------------*/
1148 /*----------------------------------------------------------------------*/
1153 else if (STRCASEEQ('i','I',"ijam",name)) {
1154 /*----------------------------------------------------------------------*/
1156 /*----------------------------------------------------------------------*/
1159 else if (STRCASEEQ('u','U',"utn",name)) {
1160 /*----------------------------------------------------------------------*/
1162 /* It is special only for CHTML. */
1163 /*----------------------------------------------------------------------*/
1166 else if (STRCASEEQ('t','T',"telbook",name)) {
1167 /*----------------------------------------------------------------------*/
1169 /*----------------------------------------------------------------------*/
1172 else if (STRCASEEQ('k','K',"kana",name)) {
1173 /*----------------------------------------------------------------------*/
1175 /*----------------------------------------------------------------------*/
1178 else if (STRCASEEQ('e','E',"email",name)) {
1179 /*----------------------------------------------------------------------*/
1181 /*----------------------------------------------------------------------*/
1184 else if (STRCASEEQ('i','I',"ista",name)) {
1185 /*----------------------------------------------------------------------*/
1187 /*----------------------------------------------------------------------*/
1190 else if (STRCASEEQ('i','I',"ilet",name)) {
1191 /*----------------------------------------------------------------------*/
1193 /*----------------------------------------------------------------------*/
1196 else if (STRCASEEQ('i','I',"iswf",name)) {
1197 /*----------------------------------------------------------------------*/
1199 /*----------------------------------------------------------------------*/
1202 else if (STRCASEEQ('i','I',"irst",name)) {
1203 /*----------------------------------------------------------------------*/
1205 /*----------------------------------------------------------------------*/
1215 * It is a handler who processes the A tag.
1217 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1218 * destination is specified.
1219 * @param node [i] The A tag node is specified.
1220 * @return The conversion result is returned.
1223 s_jhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1229 jhtml = GET_JHTML(pdoc);
1239 * It is a handler who processes the BR tag.
1241 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1242 * destination is specified.
1243 * @param node [i] The BR tag node is specified.
1244 * @return The conversion result is returned.
1247 s_jhtml_start_br_tag(void *pdoc, Node *node)
1254 jhtml = GET_JHTML(pdoc);
1259 /*--------------------------------------------------------------------------*/
1260 /* Get Attributes */
1261 /*--------------------------------------------------------------------------*/
1262 for (attr = qs_get_attr(doc,node);
1264 attr = qs_get_next_attr(doc,attr)) {
1265 char *name = qs_get_attr_name(doc,attr);
1266 char *value = qs_get_attr_value(doc,attr);
1267 if (STRCASEEQ('c','C',"clear",name)) {
1268 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1281 * It is a handler who processes the BR tag.
1283 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1284 * destination is specified.
1285 * @param node [i] The BR tag node is specified.
1286 * @return The conversion result is returned.
1289 s_jhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1291 jhtml_t *jhtml = GET_JHTML(pdoc);
1297 * It is a handler who processes the TR tag.
1299 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1300 * destination is specified.
1301 * @param node [i] The TR tag node is specified.
1302 * @return The conversion result is returned.
1305 s_jhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1311 jhtml = GET_JHTML(pdoc);
1321 * It is a handler who processes the TR tag.
1323 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1324 * destination is specified.
1325 * @param node [i] The TR tag node is specified.
1326 * @return The conversion result is returned.
1329 s_jhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1331 jhtml_t *jhtml = GET_JHTML(pdoc);
1337 * It is a handler who processes the FONT tag.
1339 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1340 * destination is specified.
1341 * @param node [i] The FONT tag node is specified.
1342 * @return The conversion result is returned.
1345 s_jhtml_start_font_tag(void *pdoc, Node *node)
1353 jhtml = GET_JHTML(pdoc);
1357 /*--------------------------------------------------------------------------*/
1358 /* Get Attributes */
1359 /*--------------------------------------------------------------------------*/
1360 for (attr = qs_get_attr(doc,node);
1362 attr = qs_get_next_attr(doc,attr)) {
1363 char *name = qs_get_attr_name(doc,attr);
1364 char *value = qs_get_attr_value(doc,attr);
1365 if (STRCASEEQ('c','C',"color",name) && value && *value) {
1366 color = apr_pstrdup(doc->buf.pool, value);
1369 else if (STRCASEEQ('s','S',"size",name)) {
1370 /*----------------------------------------------------------------------*/
1372 /*----------------------------------------------------------------------*/
1377 W_L("<font color=\"");
1387 * It is a handler who processes the FONT tag.
1389 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1390 * destination is specified.
1391 * @param node [i] The FONT tag node is specified.
1392 * @return The conversion result is returned.
1395 s_jhtml_end_font_tag(void *pdoc, Node *UNUSED(child))
1401 jhtml = GET_JHTML(pdoc);
1405 if (jhtml->font_flag) {
1414 * It is a handler who processes the FORM tag.
1416 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1417 * destination is specified.
1418 * @param node [i] The FORM tag node is specified.
1419 * @return The conversion result is returned.
1422 s_jhtml_start_form_tag(void *pdoc, Node *node)
1428 char *new_hidden_tag = NULL;
1429 char *attr_method = NULL;
1430 char *attr_action = NULL;
1431 char *attr_utn = NULL;
1433 jhtml = GET_JHTML(pdoc);
1437 /*--------------------------------------------------------------------------*/
1438 /* Get Attributes */
1439 /*--------------------------------------------------------------------------*/
1440 for (attr = qs_get_attr(doc,node);
1442 attr = qs_get_next_attr(doc,attr)) {
1443 char *name = qs_get_attr_name(doc,attr);
1444 char *value = qs_get_attr_value(doc,attr);
1445 if (STRCASEEQ('a','A',"action", name)) {
1446 /*----------------------------------------------------------------------*/
1448 /*----------------------------------------------------------------------*/
1449 attr_action = chxj_encoding_parameter(r, value);
1450 attr_action = chxj_add_cookie_parameter(r, attr_action, jhtml->cookie);
1452 else if (STRCASEEQ('m','M',"method", name)) {
1453 /*----------------------------------------------------------------------*/
1455 /*----------------------------------------------------------------------*/
1456 attr_method = apr_pstrdup(doc->pool, value);
1458 else if (STRCASEEQ('u','U',"utn", name)) {
1459 /*----------------------------------------------------------------------*/
1461 /* It is special only for CHTML. */
1462 /*----------------------------------------------------------------------*/
1467 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
1472 char *old_qs = NULL;
1473 q = strchr(attr_action, '?');
1475 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag, &old_qs, CHXJ_FALSE, CHXJ_TRUE, jhtml->entryp);
1476 if (new_hidden_tag || old_qs) {
1497 if (new_hidden_tag) {
1498 W_V(new_hidden_tag);
1505 * It is a handler who processes the FORM tag.
1507 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1508 * destination is specified.
1509 * @param node [i] The FORM tag node is specified.
1510 * @return The conversion result is returned.
1513 s_jhtml_end_form_tag(void *pdoc, Node *UNUSED(child))
1515 jhtml_t *jhtml = GET_JHTML(pdoc);
1516 Doc *doc = jhtml->doc;
1523 * It is a handler who processes the INPUT tag.
1525 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1526 * destination is specified.
1527 * @param node [i] The INPUT tag node is specified.
1528 * @return The conversion result is returned.
1531 s_jhtml_start_input_tag(void *pdoc, Node *node)
1545 jhtml = GET_JHTML(pdoc);
1558 /*--------------------------------------------------------------------------*/
1559 /* Get Attributes */
1560 /*--------------------------------------------------------------------------*/
1561 type = qs_get_type_attr(doc, node, doc->buf.pool);
1562 name = qs_get_name_attr(doc, node, doc->buf.pool);
1563 value = qs_get_value_attr(doc,node,doc->buf.pool);
1564 istyle = qs_get_istyle_attr(doc,node,doc->buf.pool);
1565 max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
1566 checked = qs_get_checked_attr(doc,node,doc->buf.pool);
1567 accesskey = qs_get_accesskey_attr(doc, node, doc->buf.pool);
1568 size = qs_get_size_attr(doc, node, doc->buf.pool);
1571 if (type && (STRCASEEQ('t','T',"text", type) ||
1572 STRCASEEQ('p','P',"password",type) ||
1573 STRCASEEQ('c','C',"checkbox",type) ||
1574 STRCASEEQ('r','R',"radio", type) ||
1575 STRCASEEQ('h','H',"hidden", type) ||
1576 STRCASEEQ('s','S',"submit", type) ||
1577 STRCASEEQ('r','R',"reset", type))) {
1583 if (size && *size) {
1588 if (name && *name) {
1590 W_V(chxj_jreserved_to_safe_tag(r, name, jhtml->entryp));
1593 if (value && *value) {
1594 if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
1595 apr_size_t value_len = strlen(value);
1596 value = chxj_conv_z2h(r, value, &value_len, jhtml->entryp);
1600 W_V(chxj_add_slash_to_doublequote(doc->pool, value));
1603 if (accesskey && *accesskey) {
1604 W_L(" accesskey=\"");
1608 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1609 /*------------------------------------------------------------------------*/
1611 /*------------------------------------------------------------------------*/
1612 if (type && STRCASEEQ('p','P',"password", type) && ! jhtml->entryp->pc_flag ) {
1618 char *vv = chxj_istyle_to_mode(doc->buf.pool,istyle);
1624 else if (type && STRCASEEQ('p','P',"password",type)) {
1629 /*--------------------------------------------------------------------------*/
1630 /* The figure is default for the password. */
1631 /*--------------------------------------------------------------------------*/
1632 if (max_length && *max_length) {
1633 if (chxj_chk_numeric(max_length) == 0) {
1634 W_L(" maxlength=\"");
1649 * It is a handler who processes the INPUT tag.
1651 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1652 * destination is specified.
1653 * @param node [i] The INPUT tag node is specified.
1654 * @return The conversion result is returned.
1657 s_jhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
1659 jhtml_t *jhtml = GET_JHTML(pdoc);
1665 * It is a handler who processes the CENTER tag.
1667 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1668 * destination is specified.
1669 * @param node [i] The CENTER tag node is specified.
1670 * @return The conversion result is returned.
1673 s_jhtml_start_center_tag(void *pdoc, Node *UNUSED(node))
1675 jhtml_t *jhtml = GET_JHTML(pdoc);
1676 Doc *doc = jhtml->doc;
1683 * It is a handler who processes the CENTER tag.
1685 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1686 * destination is specified.
1687 * @param node [i] The CENTER tag node is specified.
1688 * @return The conversion result is returned.
1691 s_jhtml_end_center_tag(void *pdoc, Node *UNUSED(child))
1697 jhtml = GET_JHTML(pdoc);
1707 * It is a handler who processes the li tag.
1709 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1710 * destination is specified.
1711 * @param node [i] The li tag node is specified.
1712 * @return The conversion result is returned.
1715 s_jhtml_start_li_tag(void *pdoc, Node *node)
1722 jhtml = GET_JHTML(pdoc);
1727 /*--------------------------------------------------------------------------*/
1728 /* Get Attributes */
1729 /*--------------------------------------------------------------------------*/
1730 for (attr = qs_get_attr(doc,node);
1732 attr = qs_get_next_attr(doc,attr)) {
1733 char *name = qs_get_attr_name(doc,attr);
1734 char *value = qs_get_attr_value(doc,attr);
1735 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1740 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
1752 * It is a handler who processes the li tag.
1754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1755 * destination is specified.
1756 * @param node [i] The li tag node is specified.
1757 * @return The conversion result is returned.
1760 s_jhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
1766 jhtml = GET_JHTML(pdoc);
1776 * It is a handler who processes the OL tag.
1778 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1779 * destination is specified.
1780 * @param node [i] The OL tag node is specified.
1781 * @return The conversion result is returned.
1784 s_jhtml_start_ol_tag(void *pdoc, Node *node)
1791 jhtml = GET_JHTML(pdoc);
1796 /*--------------------------------------------------------------------------*/
1797 /* Get Attributes */
1798 /*--------------------------------------------------------------------------*/
1799 for (attr = qs_get_attr(doc,node);
1801 attr = qs_get_next_attr(doc,attr)) {
1802 char *name = qs_get_attr_name(doc,attr);
1803 char *value = qs_get_attr_value(doc,attr);
1804 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1809 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
1821 * It is a handler who processes the OL tag.
1823 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1824 * destination is specified.
1825 * @param node [i] The OL tag node is specified.
1826 * @return The conversion result is returned.
1829 s_jhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
1835 jhtml = GET_JHTML(pdoc);
1845 * It is a handler who processes the P tag.
1847 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1848 * destination is specified.
1849 * @param node [i] The P tag node is specified.
1850 * @return The conversion result is returned.
1853 s_jhtml_start_p_tag(void *pdoc, Node *node)
1861 jhtml = GET_JHTML(pdoc);
1866 for (attr = qs_get_attr(doc,node);
1868 attr = qs_get_next_attr(doc,attr)) {
1869 char *nm = qs_get_attr_name(doc,attr);
1870 char *val = qs_get_attr_value(doc,attr);
1871 if (STRCASEEQ('a','A',"align", nm)) {
1872 /*----------------------------------------------------------------------*/
1873 /* CHTML 1.0 (W3C version 3.2) */
1874 /*----------------------------------------------------------------------*/
1875 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1876 align = apr_pstrdup(doc->buf.pool, val);
1892 * It is a handler who processes the P tag.
1894 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1895 * destination is specified.
1896 * @param node [i] The P tag node is specified.
1897 * @return The conversion result is returned.
1900 s_jhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
1902 jhtml_t *jhtml = GET_JHTML(pdoc);
1903 Doc *doc = jhtml->doc;
1911 * It is a handler who processes the PRE tag.
1913 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1914 * destination is specified.
1915 * @param node [i] The PRE tag node is specified.
1916 * @return The conversion result is returned.
1919 s_jhtml_start_pre_tag(void *pdoc, Node *UNUSED(node))
1921 jhtml_t *jhtml = GET_JHTML(pdoc);
1922 Doc *doc = jhtml->doc;
1931 * It is a handler who processes the PRE tag.
1933 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1934 * destination is specified.
1935 * @param node [i] The PRE tag node is specified.
1936 * @return The conversion result is returned.
1939 s_jhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
1941 jhtml_t *jhtml = GET_JHTML(pdoc);
1942 Doc *doc = jhtml->doc;
1952 * It is a handler who processes the UL tag.
1954 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1955 * destination is specified.
1956 * @param node [i] The UL tag node is specified.
1957 * @return The conversion result is returned.
1960 s_jhtml_start_ul_tag(void *pdoc, Node *UNUSED(node))
1962 jhtml_t *jhtml = GET_JHTML(pdoc);
1963 Doc *doc = jhtml->doc;
1971 * It is a handler who processes the UL tag.
1973 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1974 * destination is specified.
1975 * @param node [i] The UL tag node is specified.
1976 * @return The conversion result is returned.
1979 s_jhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
1981 jhtml_t *jhtml = GET_JHTML(pdoc);
1982 Doc *doc = jhtml->doc;
1990 * It is a handler who processes the HR tag.
1992 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1993 * destination is specified.
1994 * @param node [i] The HR tag node is specified.
1995 * @return The conversion result is returned.
1998 s_jhtml_start_hr_tag(void *pdoc, Node *node)
2000 jhtml_t *jhtml = GET_JHTML(pdoc);
2001 Doc *doc = jhtml->doc;
2005 for (attr = qs_get_attr(doc,node);
2007 attr = qs_get_next_attr(doc,attr)) {
2008 char *name = qs_get_attr_name(doc,attr);
2009 char *value = qs_get_attr_value(doc,attr);
2010 if (STRCASEEQ('a','A',"align",name)) {
2011 /*----------------------------------------------------------------------*/
2013 /*----------------------------------------------------------------------*/
2014 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2020 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2021 /*----------------------------------------------------------------------*/
2023 /*----------------------------------------------------------------------*/
2028 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2029 /*----------------------------------------------------------------------*/
2031 /*----------------------------------------------------------------------*/
2036 else if (STRCASEEQ('n','N',"noshade",name)) {
2037 /*----------------------------------------------------------------------*/
2039 /*----------------------------------------------------------------------*/
2042 else if (STRCASEEQ('c','C',"color",name) && value && *value) {
2043 /*----------------------------------------------------------------------*/
2045 /*----------------------------------------------------------------------*/
2057 * It is a handler who processes the HR tag.
2059 * @param jhtml [i/o] The pointer to the CHTML structure at the output
2060 * destination is specified.
2061 * @param node [i] The HR tag node is specified.
2062 * @return The conversion result is returned.
2065 s_jhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
2067 jhtml_t *jhtml = GET_JHTML(pdoc);
2073 * It is a handler who processes the IMG tag.
2075 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2076 * destination is specified.
2077 * @param node [i] The IMG tag node is specified.
2078 * @return The conversion result is returned.
2081 s_jhtml_start_img_tag(void *pdoc, Node *node)
2083 jhtml_t *jhtml = GET_JHTML(pdoc);
2084 Doc *doc = jhtml->doc;
2085 request_rec *r = doc->r;
2087 #ifndef IMG_NOT_CONVERT_FILENAME
2088 device_table *spec = jhtml->spec;
2092 /*--------------------------------------------------------------------------*/
2093 /* Get Attributes */
2094 /*--------------------------------------------------------------------------*/
2095 for (attr = qs_get_attr(doc,node);
2097 attr = qs_get_next_attr(doc,attr)) {
2098 char *name = qs_get_attr_name(doc,attr);
2099 char *value = qs_get_attr_value(doc,attr);
2100 if (STRCASEEQ('s','S',"src",name)) {
2101 /*----------------------------------------------------------------------*/
2103 /*----------------------------------------------------------------------*/
2104 #ifdef IMG_NOT_CONVERT_FILENAME
2105 value = chxj_encoding_parameter(r, value);
2106 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp);
2107 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2108 value = chxj_add_cookie_no_update_parameter(r, value);
2109 value = s_add_copyright_parameter(r, value);
2114 value = chxj_img_conv(r, spec, value);
2115 value = chxj_encoding_parameter(r, value);
2116 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp);
2117 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
2118 value = chxj_add_cookie_no_update_parameter(r, value);
2119 value = s_add_copyright_parameter(r, value);
2125 else if (STRCASEEQ('a','A',"align",name)) {
2126 /*----------------------------------------------------------------------*/
2128 /*----------------------------------------------------------------------*/
2130 if (STRCASEEQ('t','T',"top", value) ||
2131 STRCASEEQ('m','M',"middle",value) ||
2132 STRCASEEQ('b','B',"bottom",value) ||
2133 STRCASEEQ('l','L',"left", value) ||
2134 STRCASEEQ('r','R',"right", value)) {
2139 else if (STRCASEEQ('c','C',"center",value)) {
2146 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2147 /*----------------------------------------------------------------------*/
2149 /*----------------------------------------------------------------------*/
2154 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2155 /*----------------------------------------------------------------------*/
2157 /*----------------------------------------------------------------------*/
2162 else if (STRCASEEQ('h','H',"hspace",name)) {
2163 /*----------------------------------------------------------------------*/
2165 /*----------------------------------------------------------------------*/
2168 else if (STRCASEEQ('v','V',"vspace",name)) {
2169 /*----------------------------------------------------------------------*/
2171 /*----------------------------------------------------------------------*/
2174 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2175 /*----------------------------------------------------------------------*/
2177 /*----------------------------------------------------------------------*/
2189 * It is a handler who processes the IMG tag.
2191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2192 * destination is specified.
2193 * @param node [i] The IMG tag node is specified.
2194 * @return The conversion result is returned.
2197 s_jhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
2199 jhtml_t *jhtml = GET_JHTML(pdoc);
2205 * It is a handler who processes the SELECT tag.
2207 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2208 * destination is specified.
2209 * @param node [i] The SELECT tag node is specified.
2210 * @return The conversion result is returned.
2213 s_jhtml_start_select_tag(void *pdoc, Node *child)
2215 jhtml_t *jhtml = GET_JHTML(pdoc);
2216 Doc *doc = jhtml->doc;
2220 char *multiple = NULL;
2223 for (attr = qs_get_attr(doc,child);
2225 attr = qs_get_next_attr(doc,attr)) {
2226 char *nm = qs_get_attr_name(doc,attr);
2227 char *val = qs_get_attr_value(doc,attr);
2228 if (STRCASEEQ('s','S',"size",nm)) {
2229 /*----------------------------------------------------------------------*/
2230 /* CHTML 1.0 version 2.0 */
2231 /*----------------------------------------------------------------------*/
2232 size = apr_pstrdup(doc->buf.pool, val);
2234 else if (STRCASEEQ('n','N',"name",nm)) {
2235 /*----------------------------------------------------------------------*/
2236 /* CHTML 1.0 version 2.0 */
2237 /*----------------------------------------------------------------------*/
2238 name = apr_pstrdup(doc->buf.pool, val);
2240 else if (STRCASEEQ('m','M',"multiple", nm)) {
2241 /*----------------------------------------------------------------------*/
2242 /* CHTML 1.0 version 2.0 */
2243 /*----------------------------------------------------------------------*/
2244 multiple = apr_pstrdup(doc->buf.pool, val);
2247 if (size && *size) {
2252 if (name && *name) {
2266 * It is a handler who processes the SELECT tag.
2268 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2269 * destination is specified.
2270 * @param node [i] The SELECT tag node is specified.
2271 * @return The conversion result is returned.
2274 s_jhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
2276 jhtml_t *jhtml = GET_JHTML(pdoc);
2277 Doc *doc = jhtml->doc;
2284 * It is a handler who processes the OPTION tag.
2286 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2287 * destination is specified.
2288 * @param node [i] The OPTION tag node is specified.
2289 * @return The conversion result is returned.
2292 s_jhtml_start_option_tag(void *pdoc, Node *child)
2294 jhtml_t *jhtml = GET_JHTML(pdoc);
2295 Doc *doc = jhtml->doc;
2298 char *selected = NULL;
2302 for (attr = qs_get_attr(doc,child);
2304 attr = qs_get_next_attr(doc,attr)) {
2305 char *nm = qs_get_attr_name(doc,attr);
2306 char *val = qs_get_attr_value(doc,attr);
2307 if (STRCASEEQ('s','S',"selected",nm)) {
2308 /*----------------------------------------------------------------------*/
2309 /* CHTML 1.0 version 2.0 */
2310 /*----------------------------------------------------------------------*/
2311 selected = apr_pstrdup(doc->buf.pool, val);
2313 else if (STRCASEEQ('v','V',"value",nm)) {
2314 /*----------------------------------------------------------------------*/
2315 /* CHTML 1.0 version 2.0 */
2316 /*----------------------------------------------------------------------*/
2317 value = apr_pstrdup(doc->buf.pool, val);
2334 * It is a handler who processes the OPTION tag.
2336 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2337 * destination is specified.
2338 * @param node [i] The OPTION tag node is specified.
2339 * @return The conversion result is returned.
2342 s_jhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
2344 jhtml_t *jhtml = GET_JHTML(pdoc);
2351 * It is a handler who processes the DIV tag.
2353 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2354 * destination is specified.
2355 * @param node [i] The DIV tag node is specified.
2356 * @return The conversion result is returned.
2359 s_jhtml_start_div_tag(void *pdoc, Node *child)
2367 jhtml = GET_JHTML(pdoc);
2372 for (attr = qs_get_attr(doc,child);
2374 attr = qs_get_next_attr(doc,attr)) {
2375 char *nm = qs_get_attr_name(doc,attr);
2376 char *val = qs_get_attr_value(doc,attr);
2377 if (STRCASEEQ('a','A',"align",nm)) {
2378 /*----------------------------------------------------------------------*/
2379 /* CHTML 1.0 (W3C version 3.2) */
2380 /*----------------------------------------------------------------------*/
2381 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2382 align = apr_pstrdup(doc->buf.pool, val);
2397 * It is a handler who processes the DIV tag.
2399 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2400 * destination is specified.
2401 * @param node [i] The DIV tag node is specified.
2402 * @return The conversion result is returned.
2405 s_jhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
2411 jhtml = GET_JHTML(pdoc);
2421 chxj_istyle_to_mode(apr_pool_t *p, const char *s)
2427 case '1': return apr_psprintf(p, "hiragana");
2428 case '2': return apr_psprintf(p, "hankakukana");
2429 case '3': return apr_psprintf(p, "alphabet");
2430 case '4': return apr_psprintf(p, "numeric");
2432 tmp = apr_palloc(p, 1);
2434 return apr_pstrdup(p, tmp);
2438 tmp = apr_palloc(p, 1);
2440 return apr_pstrdup(p,tmp);
2445 s_jhtml_chxjif_tag(void *pdoc, Node *node)
2452 jhtml = GET_JHTML(pdoc);
2456 for (child = qs_get_child_node(doc, node);
2458 child = qs_get_next_node(doc, child)) {
2460 s_jhtml_chxjif_tag(jhtml, child);
2467 * It is a handler who processes the TEXTARE tag.
2469 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2470 * destination is specified.
2471 * @param node [i] The TEXTAREA tag node is specified.
2472 * @return The conversion result is returned.
2475 s_jhtml_start_textarea_tag(void *pdoc, Node *node)
2482 jhtml = GET_JHTML(pdoc);
2486 jhtml->textarea_flag++;
2488 for (attr = qs_get_attr(doc,node);
2490 attr = qs_get_next_attr(doc,attr)) {
2491 char *name = qs_get_attr_name(doc,attr);
2492 char *value = qs_get_attr_value(doc,attr);
2493 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
2494 W_L(" accesskey=\"");
2498 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
2499 char *vv = chxj_istyle_to_mode(doc->buf.pool,value);
2504 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
2509 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
2514 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
2526 * It is a handler who processes the TEXTAREA tag.
2528 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2529 * destination is specified.
2530 * @param node [i] The TEXTAREA tag node is specified.
2531 * @return The conversion result is returned.
2534 s_jhtml_end_textarea_tag(void *pdoc, Node *UNUSED(child))
2540 jhtml = GET_JHTML(pdoc);
2545 jhtml->textarea_flag--;
2552 * It is a handler who processes the B tag.
2554 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2555 * destination is specified.
2556 * @param node [i] The B tag node is specified.
2557 * @return The conversion result is returned.
2560 s_jhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
2566 jhtml = GET_JHTML(pdoc);
2576 * It is a handler who processes the B tag.
2578 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2579 * destination is specified.
2580 * @param node [i] The B tag node is specified.
2581 * @return The conversion result is returned.
2584 s_jhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
2586 jhtml_t* jhtml = GET_JHTML(pdoc);
2587 Doc* doc = jhtml->doc;
2594 s_jhtml_text_tag(void *pdoc, Node *child)
2605 apr_size_t z2h_input_len;
2607 jhtml = GET_JHTML(pdoc);
2610 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
2612 textval = qs_get_node_value(doc,child);
2613 if (strlen(textval) == 0) {
2617 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2618 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2620 tdst = qs_alloc_zero_byte_string(r->pool);
2621 memset(one_byte, 0, sizeof(one_byte));
2624 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2626 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
2628 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2633 if (is_sjis_kanji(textval[ii])) {
2634 one_byte[0] = textval[ii+0];
2635 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2636 one_byte[0] = textval[ii+1];
2637 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2641 if (jhtml->pre_flag) {
2642 one_byte[0] = textval[ii+0];
2643 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2646 if (jhtml->textarea_flag) {
2647 one_byte[0] = textval[ii+0];
2648 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2651 if (textval[ii] != '\r' && textval[ii] != '\n') {
2652 one_byte[0] = textval[ii+0];
2653 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2657 z2h_input_len = strlen(tdst);
2658 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jhtml->entryp);
2661 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
2667 * It is a handler who processes the BLOCKQUOTE tag.
2669 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2670 * destination is specified.
2671 * @param node [i] The BLOCKQUOTE tag node is specified.
2672 * @return The conversion result is returned.
2675 s_jhtml_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2677 jhtml_t *jhtml = GET_JHTML(pdoc);
2678 Doc *doc = jhtml->doc;
2679 W_L("<blockquote>");
2685 * It is a handler who processes the BLOCKQUOTE tag.
2687 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2688 * destination is specified.
2689 * @param node [i] The BLOCKQUOTE tag node is specified.
2690 * @return The conversion result is returned.
2693 s_jhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2695 jhtml_t *jhtml = GET_JHTML(pdoc);
2696 Doc *doc = jhtml->doc;
2697 W_L("</blockquote>");
2703 * It is a handler who processes the DIR tag.
2705 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2706 * destination is specified.
2707 * @param node [i] The DIR tag node is specified.
2708 * @return The conversion result is returned.
2711 s_jhtml_start_dir_tag(void *pdoc, Node *UNUSED(child))
2713 jhtml_t *jhtml = GET_JHTML(pdoc);
2714 Doc *doc = jhtml->doc;
2721 * It is a handler who processes the DIR tag.
2723 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2724 * destination is specified.
2725 * @param node [i] The DIR tag node is specified.
2726 * @return The conversion result is returned.
2729 s_jhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
2731 jhtml_t *jhtml = GET_JHTML(pdoc);
2732 Doc *doc = jhtml->doc;
2739 * It is a handler who processes the DL tag.
2741 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2742 * destination is specified.
2743 * @param node [i] The DL tag node is specified.
2744 * @return The conversion result is returned.
2747 s_jhtml_start_dl_tag(void *pdoc, Node *UNUSED(child))
2749 jhtml_t *jhtml = GET_JHTML(pdoc);
2750 Doc *doc = jhtml->doc;
2757 * It is a handler who processes the DL tag.
2759 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2760 * destination is specified.
2761 * @param node [i] The DL tag node is specified.
2762 * @return The conversion result is returned.
2765 s_jhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
2767 jhtml_t *jhtml = GET_JHTML(pdoc);
2768 Doc *doc = jhtml->doc;
2775 * It is a handler who processes the DT tag.
2777 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2778 * destination is specified.
2779 * @param node [i] The DT tag node is specified.
2780 * @return The conversion result is returned.
2783 s_jhtml_start_dt_tag(void *pdoc, Node *UNUSED(child))
2785 jhtml_t *jhtml = GET_JHTML(pdoc);
2786 Doc *doc = jhtml->doc;
2793 * It is a handler who processes the DT tag.
2795 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2796 * destination is specified.
2797 * @param node [i] The DT tag node is specified.
2798 * @return The conversion result is returned.
2801 s_jhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
2803 jhtml_t *jhtml = GET_JHTML(pdoc);
2809 * It is a handler who processes the DD tag.
2811 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2812 * destination is specified.
2813 * @param node [i] The DD tag node is specified.
2814 * @return The conversion result is returned.
2817 s_jhtml_start_dd_tag(void *pdoc, Node *UNUSED(child))
2819 jhtml_t *jhtml = GET_JHTML(pdoc);
2820 Doc *doc = jhtml->doc;
2827 * It is a handler who processes the DD tag.
2829 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2830 * destination is specified.
2831 * @param node [i] The DD tag node is specified.
2832 * @return The conversion result is returned.
2835 s_jhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
2837 jhtml_t *jhtml = GET_JHTML(pdoc);
2843 * It is a handler who processes the H1 tag.
2845 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2846 * destination is specified.
2847 * @param node [i] The H1 tag node is specified.
2848 * @return The conversion result is returned.
2851 s_jhtml_start_h1_tag(void *pdoc, Node *node)
2859 jhtml = GET_JHTML(pdoc);
2863 for (attr = qs_get_attr(doc,node);
2865 attr = qs_get_next_attr(doc,attr)) {
2866 char *name = qs_get_attr_name(doc,attr);
2867 char *value = qs_get_attr_value(doc,attr);
2868 if (STRCASEEQ('a','A',"align", name)) {
2869 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2870 jhtml->h1_align_flag++;
2871 align = apr_pstrdup(doc->buf.pool, value);
2877 W_L("<div align=\"");
2887 * It is a handler who processes the H1 tag.
2889 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2890 * destination is specified.
2891 * @param node [i] The H1 tag node is specified.
2892 * @return The conversion result is returned.
2895 s_jhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
2901 jhtml = GET_JHTML(pdoc);
2906 if (jhtml->h1_align_flag) {
2907 jhtml->h1_align_flag--;
2915 * It is a handler who processes the H2 tag.
2917 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2918 * destination is specified.
2919 * @param node [i] The H1 tag node is specified.
2920 * @return The conversion result is returned.
2923 s_jhtml_start_h2_tag(void *pdoc, Node *node)
2931 jhtml = GET_JHTML(pdoc);
2935 for (attr = qs_get_attr(doc,node);
2937 attr = qs_get_next_attr(doc,attr)) {
2940 name = qs_get_attr_name(doc,attr);
2941 value = qs_get_attr_value(doc,attr);
2942 if (STRCASEEQ('a','A',"align", name)) {
2943 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2944 jhtml->h2_align_flag++;
2945 align = apr_pstrdup(doc->buf.pool, value);
2951 W_L("<div align=\"");
2961 * It is a handler who processes the H2 tag.
2963 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2964 * destination is specified.
2965 * @param node [i] The H1 tag node is specified.
2966 * @return The conversion result is returned.
2969 s_jhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
2975 jhtml = GET_JHTML(pdoc);
2980 if (jhtml->h2_align_flag) {
2981 jhtml->h2_align_flag--;
2989 * It is a handler who processes the H3 tag.
2991 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2992 * destination is specified.
2993 * @param node [i] The H1 tag node is specified.
2994 * @return The conversion result is returned.
2997 s_jhtml_start_h3_tag(void *pdoc, Node *node)
3005 jhtml = GET_JHTML(pdoc);
3009 for (attr = qs_get_attr(doc,node);
3011 attr = qs_get_next_attr(doc,attr)) {
3014 name = qs_get_attr_name(doc,attr);
3015 value = qs_get_attr_value(doc,attr);
3016 if (STRCASEEQ('a','A',"align", name)) {
3017 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3018 jhtml->h3_align_flag++;
3019 align = apr_pstrdup(doc->buf.pool, value);
3025 W_L("<div align=\"");
3035 * It is a handler who processes the H3 tag.
3037 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3038 * destination is specified.
3039 * @param node [i] The H1 tag node is specified.
3040 * @return The conversion result is returned.
3043 s_jhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
3049 jhtml = GET_JHTML(pdoc);
3054 if (jhtml->h3_align_flag) {
3055 jhtml->h3_align_flag--;
3063 * It is a handler who processes the H4 tag.
3065 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3066 * destination is specified.
3067 * @param node [i] The H1 tag node is specified.
3068 * @return The conversion result is returned.
3071 s_jhtml_start_h4_tag(void *pdoc, Node *node)
3079 jhtml = GET_JHTML(pdoc);
3083 for (attr = qs_get_attr(doc,node);
3085 attr = qs_get_next_attr(doc,attr)) {
3086 char *name = qs_get_attr_name(doc,attr);
3087 char *value = qs_get_attr_value(doc,attr);
3088 if (STRCASEEQ('a','A',"align", name)) {
3089 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3090 jhtml->h4_align_flag++;
3091 align = apr_pstrdup(doc->buf.pool, value);
3097 W_L("<div align=\"");
3107 * It is a handler who processes the H4 tag.
3109 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3110 * destination is specified.
3111 * @param node [i] The H1 tag node is specified.
3112 * @return The conversion result is returned.
3115 s_jhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
3121 jhtml = GET_JHTML(pdoc);
3126 if (jhtml->h4_align_flag) {
3127 jhtml->h4_align_flag--;
3135 * It is a handler who processes the H5 tag.
3137 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3138 * destination is specified.
3139 * @param node [i] The H1 tag node is specified.
3140 * @return The conversion result is returned.
3143 s_jhtml_start_h5_tag(void *pdoc, Node *node)
3151 jhtml = GET_JHTML(pdoc);
3155 for (attr = qs_get_attr(doc,node);
3157 attr = qs_get_next_attr(doc,attr)) {
3158 char *name = qs_get_attr_name(doc,attr);
3159 char *value = qs_get_attr_value(doc,attr);
3160 if (STRCASEEQ('a','A',"align", name)) {
3161 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3162 jhtml->h5_align_flag++;
3163 align = apr_pstrdup(doc->buf.pool, value);
3169 W_L("<div align=\"");
3179 * It is a handler who processes the H5 tag.
3181 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3182 * destination is specified.
3183 * @param node [i] The H1 tag node is specified.
3184 * @return The conversion result is returned.
3187 s_jhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
3193 jhtml = GET_JHTML(pdoc);
3198 if (jhtml->h5_align_flag) {
3199 jhtml->h5_align_flag--;
3207 * It is a handler who processes the H6 tag.
3209 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3210 * destination is specified.
3211 * @param node [i] The H1 tag node is specified.
3212 * @return The conversion result is returned.
3215 s_jhtml_start_h6_tag(void *pdoc, Node *node)
3223 jhtml = GET_JHTML(pdoc);
3227 for (attr = qs_get_attr(doc,node);
3229 attr = qs_get_next_attr(doc,attr)) {
3230 char *name = qs_get_attr_name(doc,attr);
3231 char *value = qs_get_attr_value(doc,attr);
3232 if (STRCASEEQ('a','A',"align", name)) {
3233 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3234 jhtml->h6_align_flag++;
3235 align = apr_pstrdup(doc->buf.pool, value);
3241 W_L("<div align=\"");
3251 * It is a handler who processes the H6 tag.
3253 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3254 * destination is specified.
3255 * @param node [i] The H1 tag node is specified.
3256 * @return The conversion result is returned.
3259 s_jhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
3265 jhtml = GET_JHTML(pdoc);
3270 if (jhtml->h6_align_flag) {
3271 jhtml->h6_align_flag--;
3279 * It is a handler who processes the MENU tag.
3281 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3282 * destination is specified.
3283 * @param node [i] The MENU tag node is specified.
3284 * @return The conversion result is returned.
3287 s_jhtml_start_menu_tag(void *pdoc, Node *UNUSED(child))
3289 jhtml_t *jhtml = GET_JHTML(pdoc);
3290 Doc *doc = jhtml->doc;
3297 * It is a handler who processes the MENU tag.
3299 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3300 * destination is specified.
3301 * @param node [i] The MENU tag node is specified.
3302 * @return The conversion result is returned.
3305 s_jhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
3307 jhtml_t *jhtml = GET_JHTML(pdoc);
3308 Doc *doc = jhtml->doc;
3315 * It is a handler who processes the PLAINTEXT tag.
3317 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3318 * destination is specified.
3319 * @param node [i] The PLAINTEXT tag node is specified.
3320 * @return The conversion result is returned.
3323 s_jhtml_start_plaintext_tag(void *pdoc, Node *node)
3328 jhtml = GET_JHTML(pdoc);
3331 s_jhtml_start_plaintext_tag_inner(pdoc,node);
3336 s_jhtml_start_plaintext_tag_inner(void *pdoc, Node *node)
3341 jhtml = GET_JHTML(pdoc);
3343 for (child = qs_get_child_node(doc, node);
3345 child = qs_get_next_node(doc, child)) {
3347 s_jhtml_start_plaintext_tag_inner(pdoc, child);
3354 * It is a handler who processes the PLAINTEXT tag.
3356 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3357 * destination is specified.
3358 * @param node [i] The PLAINTEXT tag node is specified.
3359 * @return The conversion result is returned.
3362 s_jhtml_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3364 jhtml_t *jhtml = GET_JHTML(pdoc);
3370 * It is a handler who processes the BLINK tag.
3372 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3373 * destination is specified.
3374 * @param node [i] The BLINK tag node is specified.
3375 * @return The conversion result is returned.
3378 s_jhtml_start_blink_tag(void *pdoc, Node *UNUSED(child))
3380 jhtml_t *jhtml = GET_JHTML(pdoc);
3381 Doc *doc = jhtml->doc;
3388 * It is a handler who processes the BLINK tag.
3390 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3391 * destination is specified.
3392 * @param node [i] The BLINK tag node is specified.
3393 * @return The conversion result is returned.
3396 s_jhtml_end_blink_tag(void *pdoc, Node *UNUSED(child))
3398 jhtml_t *jhtml = GET_JHTML(pdoc);
3399 Doc *doc = jhtml->doc;
3406 * It is a handler who processes the MARQUEE tag.
3408 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3409 * destination is specified.
3410 * @param node [i] The MARQUEE tag node is specified.
3411 * @return The conversion result is returned.
3414 s_jhtml_start_marquee_tag(void *pdoc, Node *node)
3416 jhtml_t *jhtml = GET_JHTML(pdoc);
3417 Doc *doc = jhtml->doc;
3420 /*--------------------------------------------------------------------------*/
3421 /* Get Attributes */
3422 /*--------------------------------------------------------------------------*/
3423 for (attr = qs_get_attr(doc,node);
3425 attr = qs_get_next_attr(doc,attr)) {
3426 char *name = qs_get_attr_name(doc,attr);
3427 char *value = qs_get_attr_value(doc,attr);
3428 if (STRCASEEQ('d','D',"direction", name)) {
3429 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
3430 W_L(" direction=\"");
3435 else if (STRCASEEQ('b','B',"behavior",name)) {
3438 else if (STRCASEEQ('l','L',"loop",name)) {
3448 * It is a handler who processes the MARQUEE tag.
3450 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3451 * destination is specified.
3452 * @param node [i] The MARQUEE tag node is specified.
3453 * @return The conversion result is returned.
3456 s_jhtml_end_marquee_tag(void *pdoc, Node *UNUSED(child))
3458 jhtml_t *jhtml = GET_JHTML(pdoc);
3459 Doc *doc = jhtml->doc;
3466 * It is handler who processes the New Line Code.
3469 s_jhtml_newline_mark(void *pdoc, Node *UNUSED(node))
3471 jhtml_t *jhtml = GET_JHTML(pdoc);
3472 Doc *doc = jhtml->doc;
3478 s_add_copyright_parameter(request_rec *r, char *value)
3480 request_rec *sub_req = NULL;
3483 char *content_type = NULL;
3484 apr_table_t *headers_out = NULL;
3486 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
3487 apr_pool_create(&pool, r->pool);
3489 if (chxj_starts_with(value, "http:") || chxj_starts_with(value, "https:")) {
3490 apr_table_t *response;
3491 int response_code = 0;
3492 response = chxj_serf_head(r, pool, value, &response_code);
3493 if (response_code != HTTP_OK) {
3494 DBG(r, "REQ[%X] (serf_req->status:[%d])", TO_ADDR(r), response_code);
3495 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
3498 content_type = (char *)apr_table_get(response, "Content-Type");
3499 headers_out = response;
3502 // sub_req = ap_sub_req_method_uri("GET", value, r, r->output_filters);
3503 sub_req = ap_sub_req_lookup_uri(value, r, r->output_filters);
3504 if (sub_req->status != HTTP_OK) {
3505 DBG(r, "REQ[%X] (sub_req->status:[%d])", TO_ADDR(r), sub_req->status);
3506 ap_destroy_sub_req(sub_req);
3507 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
3510 sub_req->header_only = 1;
3511 sub_req->main = NULL;
3512 rr_status = ap_run_sub_req(sub_req);
3513 DBG(r, "REQ[%X] sub_req4:ContentType:[%s]", TO_ADDR(r), sub_req->content_type);
3514 DBG(r, "REQ[%X] rr_status:[%d]", TO_ADDR(r), rr_status);
3515 content_type = apr_pstrdup(pool, sub_req->content_type);
3516 headers_out = sub_req->headers_out;
3518 if (headers_out && apr_table_get(headers_out, "x-jphone-copyright")) {
3519 if (content_type && strncasecmp("image/jpeg", content_type, 10) == 0) {
3520 if (strchr(value, '?')) {
3521 value = apr_psprintf(pool, "%s&_chxj_copy=.jpz", value);
3524 value = apr_psprintf(pool, "%s?_chxj_copy=.jpz", value);
3527 else if (content_type && strncasecmp("image/png", content_type, 9) == 0) {
3528 if (strchr(value, '?')) {
3529 value = apr_psprintf(pool, "%s&_chxj_copy=.pnz", value);
3532 value = apr_psprintf(pool, "%s?_chxj_copy=.pnz", value);
3537 ap_destroy_sub_req(sub_req);
3539 DBG(r, "REQ[%X] (result:[%s]", TO_ADDR(r), value);
3540 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);