2 * Copyright (C) 2005-2008 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"
27 #define GET_JHTML(X) ((jhtml_t *)(X))
30 #define W_L(X) do { jhtml->out = BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, (X)); } while(0)
31 #define W_V(X) do { jhtml->out = (X) ? BUFFERED_WRITE_VALUE(jhtml->out, &doc->buf, (X)) \
32 : BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, ""); } while(0)
34 static char *s_jhtml_start_html_tag (void *pdoc, Node *node);
35 static char *s_jhtml_end_html_tag (void *pdoc, Node *node);
36 static char *s_jhtml_start_meta_tag (void *pdoc, Node *node);
37 static char *s_jhtml_end_meta_tag (void *pdoc, Node *node);
38 static char *s_jhtml_start_head_tag (void *pdoc, Node *node);
39 static char *s_jhtml_end_head_tag (void *pdoc, Node *node);
40 static char *s_jhtml_start_title_tag (void *pdoc, Node *node);
41 static char *s_jhtml_end_title_tag (void *pdoc, Node *node);
42 static char *s_jhtml_start_base_tag (void *pdoc, Node *node);
43 static char *s_jhtml_end_base_tag (void *pdoc, Node *node);
44 static char *s_jhtml_start_body_tag (void *pdoc, Node *node);
45 static char *s_jhtml_end_body_tag (void *pdoc, Node *node);
46 static char *s_jhtml_start_a_tag (void *pdoc, Node *node);
47 static char *s_jhtml_end_a_tag (void *pdoc, Node *node);
48 static char *s_jhtml_start_pre_tag (void *pdoc, Node *node);
49 static char *s_jhtml_end_pre_tag (void *pdoc, Node *node);
50 static char *s_jhtml_start_p_tag (void *pdoc, Node *node);
51 static char *s_jhtml_end_p_tag (void *pdoc, Node *node);
52 static char *s_jhtml_start_ul_tag (void *pdoc, Node *node);
53 static char *s_jhtml_end_ul_tag (void *pdoc, Node *node);
54 static char *s_jhtml_start_ol_tag (void *pdoc, Node *node);
55 static char *s_jhtml_end_ol_tag (void *pdoc, Node *node);
56 static char *s_jhtml_start_li_tag (void *pdoc, Node *node);
57 static char *s_jhtml_end_li_tag (void *pdoc, Node *node);
58 static char *s_jhtml_start_br_tag (void *pdoc, Node *node);
59 static char *s_jhtml_end_br_tag (void *pdoc, Node *node);
60 static char *s_jhtml_start_tr_tag (void *pdoc, Node *node);
61 static char *s_jhtml_end_tr_tag (void *pdoc, Node *node);
62 static char *s_jhtml_start_font_tag (void *pdoc, Node *node);
63 static char *s_jhtml_end_font_tag (void *pdoc, Node *node);
64 static char *s_jhtml_start_form_tag (void *pdoc, Node *node);
65 static char *s_jhtml_end_form_tag (void *pdoc, Node *node);
66 static char *s_jhtml_start_input_tag (void *pdoc, Node *node);
67 static char *s_jhtml_end_input_tag (void *pdoc, Node *node);
68 static char *s_jhtml_start_center_tag (void *pdoc, Node *node);
69 static char *s_jhtml_end_center_tag (void *pdoc, Node *node);
70 static char *s_jhtml_start_hr_tag (void *pdoc, Node *node);
71 static char *s_jhtml_end_hr_tag (void *pdoc, Node *node);
72 static char *s_jhtml_start_img_tag (void *pdoc, Node *node);
73 static char *s_jhtml_end_img_tag (void *pdoc, Node *node);
74 static char *s_jhtml_start_select_tag (void *pdoc, Node *node);
75 static char *s_jhtml_end_select_tag (void *pdoc, Node *node);
76 static char *s_jhtml_start_option_tag (void *pdoc, Node *node);
77 static char *s_jhtml_end_option_tag (void *pdoc, Node *node);
78 static char *s_jhtml_start_div_tag (void *pdoc, Node *node);
79 static char *s_jhtml_end_div_tag (void *pdoc, Node *node);
80 static char *s_jhtml_start_textarea_tag (void *pdoc, Node *node);
81 static char *s_jhtml_end_textarea_tag (void *pdoc, Node *node);
82 static char *s_jhtml_start_b_tag (void *pdoc, Node *node);
83 static char *s_jhtml_end_b_tag (void *pdoc, Node *node);
84 static char *s_jhtml_chxjif_tag (void *pdoc, Node *node);
85 static char *s_jhtml_text_tag (void *pdoc, Node *node);
86 static char *s_jhtml_start_blockquote_tag(void *pdoc, Node *node);
87 static char *s_jhtml_end_blockquote_tag (void *pdoc, Node *node);
88 static char *s_jhtml_start_dir_tag (void *pdoc, Node *node);
89 static char *s_jhtml_end_dir_tag (void *pdoc, Node *node);
90 static char *s_jhtml_start_dl_tag (void *pdoc, Node *node);
91 static char *s_jhtml_end_dl_tag (void *pdoc, Node *node);
92 static char *s_jhtml_start_dt_tag (void *pdoc, Node *node);
93 static char *s_jhtml_end_dt_tag (void *pdoc, Node *node);
94 static char *s_jhtml_start_dd_tag (void *pdoc, Node *node);
95 static char *s_jhtml_end_dd_tag (void *pdoc, Node *node);
96 static char *s_jhtml_start_h1_tag (void *pdoc, Node *node);
97 static char *s_jhtml_end_h1_tag (void *pdoc, Node *node);
98 static char *s_jhtml_start_h2_tag (void *pdoc, Node *node);
99 static char *s_jhtml_end_h2_tag (void *pdoc, Node *node);
100 static char *s_jhtml_start_h3_tag (void *pdoc, Node *node);
101 static char *s_jhtml_end_h3_tag (void *pdoc, Node *node);
102 static char *s_jhtml_start_h4_tag (void *pdoc, Node *node);
103 static char *s_jhtml_end_h4_tag (void *pdoc, Node *node);
104 static char *s_jhtml_start_h5_tag (void *pdoc, Node *node);
105 static char *s_jhtml_end_h5_tag (void *pdoc, Node *node);
106 static char *s_jhtml_start_h6_tag (void *pdoc, Node *node);
107 static char *s_jhtml_end_h6_tag (void *pdoc, Node *node);
109 static void s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec);
111 static int s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt);
113 static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
117 tag_handler jhtml_handler[] = {
120 s_jhtml_start_html_tag,
121 s_jhtml_end_html_tag,
125 s_jhtml_start_meta_tag,
126 s_jhtml_end_meta_tag,
130 s_jhtml_start_textarea_tag,
131 s_jhtml_end_textarea_tag,
140 s_jhtml_start_pre_tag,
145 s_jhtml_start_ul_tag,
150 s_jhtml_start_li_tag,
155 s_jhtml_start_ol_tag,
160 s_jhtml_start_h1_tag,
165 s_jhtml_start_h2_tag,
170 s_jhtml_start_h3_tag,
175 s_jhtml_start_h4_tag,
180 s_jhtml_start_h5_tag,
185 s_jhtml_start_h6_tag,
190 s_jhtml_start_head_tag,
191 s_jhtml_end_head_tag,
195 s_jhtml_start_title_tag,
196 s_jhtml_end_title_tag,
200 s_jhtml_start_base_tag,
201 s_jhtml_end_base_tag,
205 s_jhtml_start_body_tag,
206 s_jhtml_end_body_tag,
215 s_jhtml_start_br_tag,
225 s_jhtml_start_tr_tag,
240 s_jhtml_start_font_tag,
241 s_jhtml_end_font_tag,
245 s_jhtml_start_form_tag,
246 s_jhtml_end_form_tag,
250 s_jhtml_start_input_tag,
251 s_jhtml_end_input_tag,
255 s_jhtml_start_center_tag,
256 s_jhtml_end_center_tag,
260 s_jhtml_start_hr_tag,
265 s_jhtml_start_img_tag,
270 s_jhtml_start_select_tag,
271 s_jhtml_end_select_tag,
275 s_jhtml_start_option_tag,
276 s_jhtml_end_option_tag,
280 s_jhtml_start_div_tag,
330 s_jhtml_start_dt_tag,
345 s_jhtml_start_blockquote_tag,
346 s_jhtml_end_blockquote_tag,
350 s_jhtml_start_dir_tag,
355 s_jhtml_start_dl_tag,
360 s_jhtml_start_dd_tag,
387 * converts from CHTML5.0 to JHTML.
389 * @param r [i] Requet_rec is appointed.
390 * @param spec [i] The result of the device specification processing which
391 * was done in advance is appointed.
392 * @param src [i] The character string before the converting is appointed.
393 * @return The character string after the converting is returned.
402 chxjconvrule_entry *entryp,
413 /*--------------------------------------------------------------------------*/
415 /*--------------------------------------------------------------------------*/
417 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
419 DBG(r,"I found qrcode xml");
422 DBG(r,"not found qrcode xml");
424 /*--------------------------------------------------------------------------*/
425 /* The CHTML structure is initialized. */
426 /*--------------------------------------------------------------------------*/
427 s_init_jhtml(&jhtml, &doc, r, spec);
429 jhtml.entryp = entryp;
430 jhtml.cookie = cookie;
432 chxj_set_content_type(r, "text/html; charset=Windows-31J");
434 /*--------------------------------------------------------------------------*/
435 /* The character string of the input is analyzed. */
436 /*--------------------------------------------------------------------------*/
437 qs_init_malloc(&doc);
438 qs_init_root_node(&doc);
440 ss = apr_pcalloc(r->pool, srclen + 1);
442 memset(ss, 0, srclen + 1);
443 memcpy(ss, src, srclen);
446 chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
449 qs_parse_string(&doc,ss,strlen(ss));
451 chxj_buffered_write_init(r->pool, &doc.buf);
452 /*--------------------------------------------------------------------------*/
453 /* It converts it from CHTML to JHTML. */
454 /*--------------------------------------------------------------------------*/
455 chxj_node_exchange(spec,r,(void*)&jhtml, &doc, qs_get_root(&doc), 0);
456 jhtml.out = chxj_buffered_write_flush(jhtml.out, &doc.buf);
457 dst = apr_pstrdup(r->pool, jhtml.out);
458 chxj_buffered_write_terminate(&doc.buf);
461 qs_all_free(&doc,QX_LOGMARK);
464 return apr_pstrdup(r->pool,ss);
467 dst = apr_psprintf(r->pool, "\n");
469 *dstlen = strlen(dst);
472 chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
480 * The CHTML structure is initialized.
482 * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
483 * initialized is specified.
484 * @param doc [i] The Doc structure that should be set to the initialized
485 * JHTML structure is specified.
486 * @param r [i] To use POOL, the pointer to request_rec is specified.
487 * @param spec [i] The pointer to the device_table
490 s_init_jhtml(jhtml_t* jhtml, Doc* doc, request_rec* r, device_table* spec)
492 memset(doc, 0, sizeof(Doc));
493 memset(jhtml, 0, sizeof(jhtml_t));
498 jhtml->out = qs_alloc_zero_byte_string(r);
499 jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
500 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
505 * Corresponding EMOJI to a current character-code is retrieved.
506 * The substitution character string is stored in the rslt pointer if agreeing.
508 * @param jhtml [i] The pointer to the CHTML structure is specified.
509 * @param txt [i] The character string to want to examine whether it is
510 * EMOJI is specified.
511 * @param rslt [o] The pointer to the pointer that stores the result is
513 * @return When corresponding EMOJI exists, it returns it excluding 0.
516 s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt)
528 if (! spec) DBG(r,"spec is NULL");
530 for (ee = jhtml->conf->emoji;
534 unsigned char hex1byte;
535 unsigned char hex2byte;
538 DBG(r,"emoji->imode is NULL");
542 hex1byte = ee->imode->hex1byte & 0xff;
543 hex2byte = ee->imode->hex2byte & 0xff;
545 if (ee->imode->string
546 && strlen(ee->imode->string) > 0
547 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
548 if (spec == NULL || spec->emoji_type == NULL) {
549 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
550 return strlen(ee->imode->string);
557 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
558 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
559 if (spec == NULL || spec->emoji_type == NULL) {
560 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
573 * It is a handler who processes the HTML tag.
575 * @param pdoc [i/o] The pointer to the CHTML structure at the output
576 * destination is specified.
577 * @param node [i] The HTML tag node is specified.
578 * @return The conversion result is returned.
581 s_jhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
588 jhtml = GET_JHTML(pdoc);
591 DBG(r, "start s_jhtml_start_html_tag()");
593 /*--------------------------------------------------------------------------*/
595 /*--------------------------------------------------------------------------*/
598 DBG(r, "end s_jhtml_start_html_tag()");
605 * It is a handler who processes the HTML tag.
607 * @param pdoc [i/o] The pointer to the CHTML structure at the output
608 * destination is specified.
609 * @param node [i] The HTML tag node is specified.
610 * @return The conversion result is returned.
613 s_jhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
615 jhtml_t *jhtml = GET_JHTML(pdoc);
616 Doc *doc = jhtml->doc;
625 * It is a handler who processes the META tag.
627 * @param pdoc [i/o] The pointer to the CHTML structure at the output
628 * destination is specified.
629 * @param node [i] The META tag node is specified.
630 * @return The conversion result is returned.
633 s_jhtml_start_meta_tag(void *pdoc, Node *node)
639 int content_type_flag;
642 jhtml = GET_JHTML(pdoc);
646 content_type_flag = 0;
649 /*--------------------------------------------------------------------------*/
651 /*--------------------------------------------------------------------------*/
652 for (attr = qs_get_attr(doc,node);
654 attr = qs_get_next_attr(doc,attr)) {
655 char *name = qs_get_attr_name(doc,attr);
656 char *value = qs_get_attr_value(doc,attr);
660 if (strcasecmp(name, "http-equiv") == 0) {
661 /*----------------------------------------------------------------------*/
663 /*----------------------------------------------------------------------*/
664 W_L(" http-equiv=\"");
667 if (STRCASEEQ('c','C',"content-type",value)) {
668 content_type_flag = 1;
670 if (STRCASEEQ('r','R',"refresh",value)) {
678 if (strcasecmp(name, "content") == 0) {
679 /*----------------------------------------------------------------------*/
681 /*----------------------------------------------------------------------*/
682 if (content_type_flag) {
686 W_L("text/html; charset=Windows-31J");
695 buf = apr_pstrdup(r->pool, value);
697 url = strchr(buf, ';');
699 sec = apr_pstrdup(r->pool, buf);
702 url = chxj_encoding_parameter(r, url);
703 url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
733 * It is a handler who processes the META tag.
735 * @param pdoc [i/o] The pointer to the CHTML structure at the output
736 * destination is specified.
737 * @param node [i] The META tag node is specified.
738 * @return The conversion result is returned.
741 s_jhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
743 jhtml_t *jhtml = GET_JHTML(pdoc);
750 * It is a handler who processes the HEAD tag.
752 * @param pdoc [i/o] The pointer to the CHTML structure at the output
753 * destination is specified.
754 * @param node [i] The HEAD tag node is specified.
755 * @return The conversion result is returned.
758 s_jhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
764 jhtml = GET_JHTML(pdoc);
774 * It is a handler who processes the HEAD tag.
776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
777 * destination is specified.
778 * @param node [i] The HEAD tag node is specified.
779 * @return The conversion result is returned.
782 s_jhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
788 jhtml = GET_JHTML(pdoc);
798 * It is a handler who processes the TITLE tag.
800 * @param pdoc [i/o] The pointer to the CHTML structure at the output
801 * destination is specified.
802 * @param node [i] The TITLE tag node is specified.
803 * @return The conversion result is returned.
806 s_jhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
812 jhtml = GET_JHTML(pdoc);
822 * It is a handler who processes the TITLE tag.
824 * @param pdoc [i/o] The pointer to the CHTML structure at the output
825 * destination is specified.
826 * @param node [i] The TITLE tag node is specified.
827 * @return The conversion result is returned.
830 s_jhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
836 jhtml = GET_JHTML(pdoc);
846 * It is a handler who processes the BASE tag.
848 * @param pdoc [i/o] The pointer to the CHTML structure at the output
849 * destination is specified.
850 * @param node [i] The BASE tag node is specified.
851 * @return The conversion result is returned.
854 s_jhtml_start_base_tag(void *pdoc, Node *node)
861 jhtml = GET_JHTML(pdoc);
866 /*--------------------------------------------------------------------------*/
868 /*--------------------------------------------------------------------------*/
869 for (attr = qs_get_attr(doc,node);
871 attr = qs_get_next_attr(doc,attr)) {
872 char *name = qs_get_attr_name(doc,attr);
873 char *value = qs_get_attr_value(doc,attr);
874 if (STRCASEEQ('h','H',"href",name)) {
886 * It is a handler who processes the BASE tag.
888 * @param pdoc [i/o] The pointer to the CHTML structure at the output
889 * destination is specified.
890 * @param node [i] The BASE tag node is specified.
891 * @return The conversion result is returned.
894 s_jhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
896 jhtml_t *jhtml = GET_JHTML(pdoc);
902 * It is a handler who processes the BODY tag.
904 * @param pdoc [i/o] The pointer to the CHTML structure at the output
905 * destination is specified.
906 * @param node [i] The BODY tag node is specified.
907 * @return The conversion result is returned.
910 s_jhtml_start_body_tag(void *pdoc, Node *node)
917 jhtml = GET_JHTML(pdoc);
922 /*--------------------------------------------------------------------------*/
924 /*--------------------------------------------------------------------------*/
925 for (attr = qs_get_attr(doc,node);
927 attr = qs_get_next_attr(doc,attr)) {
928 char *name = qs_get_attr_name(doc,attr);
929 char *value = qs_get_attr_value(doc,attr);
930 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
931 /*----------------------------------------------------------------------*/
933 /*----------------------------------------------------------------------*/
938 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
939 /*----------------------------------------------------------------------*/
941 /*----------------------------------------------------------------------*/
946 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
947 /*----------------------------------------------------------------------*/
949 /*----------------------------------------------------------------------*/
954 else if (STRCASEEQ('a','A',"alink",name)) {
955 /*----------------------------------------------------------------------*/
957 /*----------------------------------------------------------------------*/
960 else if (STRCASEEQ('v','V',"vlink",name) && value && *value) {
961 /*----------------------------------------------------------------------*/
963 /*----------------------------------------------------------------------*/
975 * It is a handler who processes the BODY tag.
977 * @param pdoc [i/o] The pointer to the CHTML structure at the output
978 * destination is specified.
979 * @param node [i] The BODY tag node is specified.
980 * @return The conversion result is returned.
983 s_jhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
989 jhtml = GET_JHTML(pdoc);
999 * It is a handler who processes the A tag.
1001 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1002 * destination is specified.
1003 * @param node [i] The A tag node is specified.
1004 * @return The conversion result is returned.
1007 s_jhtml_start_a_tag(void *pdoc, Node *node)
1014 jhtml = GET_JHTML(pdoc);
1019 /*--------------------------------------------------------------------------*/
1020 /* Get Attributes */
1021 /*--------------------------------------------------------------------------*/
1022 for (attr = qs_get_attr(doc,node);
1024 attr = qs_get_next_attr(doc,attr)) {
1025 char *name = qs_get_attr_name(doc,attr);
1026 char *value = qs_get_attr_value(doc,attr);
1027 if (STRCASEEQ('n','N',"name",name)) {
1028 /*----------------------------------------------------------------------*/
1030 /*----------------------------------------------------------------------*/
1035 else if (STRCASEEQ('h','H',"href",name)) {
1036 /*----------------------------------------------------------------------*/
1038 /*----------------------------------------------------------------------*/
1039 value = chxj_encoding_parameter(r, value);
1040 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1045 else if (STRCASEEQ('a','A',"accesskey",name)) {
1046 /*----------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------*/
1049 W_L(" accesskey=\"");
1053 else if (STRCASEEQ('c','C',"cti",name)) {
1054 /*----------------------------------------------------------------------*/
1056 /*----------------------------------------------------------------------*/
1061 else if (STRCASEEQ('i','I',"ijam",name)) {
1062 /*----------------------------------------------------------------------*/
1064 /*----------------------------------------------------------------------*/
1067 else if (STRCASEEQ('u','U',"utn",name)) {
1068 /*----------------------------------------------------------------------*/
1070 /* It is special only for CHTML. */
1071 /*----------------------------------------------------------------------*/
1074 else if (STRCASEEQ('t','T',"telbook",name)) {
1075 /*----------------------------------------------------------------------*/
1077 /*----------------------------------------------------------------------*/
1080 else if (STRCASEEQ('k','K',"kana",name)) {
1081 /*----------------------------------------------------------------------*/
1083 /*----------------------------------------------------------------------*/
1086 else if (STRCASEEQ('e','E',"email",name)) {
1087 /*----------------------------------------------------------------------*/
1089 /*----------------------------------------------------------------------*/
1092 else if (STRCASEEQ('i','I',"ista",name)) {
1093 /*----------------------------------------------------------------------*/
1095 /*----------------------------------------------------------------------*/
1098 else if (STRCASEEQ('i','I',"ilet",name)) {
1099 /*----------------------------------------------------------------------*/
1101 /*----------------------------------------------------------------------*/
1104 else if (STRCASEEQ('i','I',"iswf",name)) {
1105 /*----------------------------------------------------------------------*/
1107 /*----------------------------------------------------------------------*/
1110 else if (STRCASEEQ('i','I',"irst",name)) {
1111 /*----------------------------------------------------------------------*/
1113 /*----------------------------------------------------------------------*/
1123 * It is a handler who processes the A tag.
1125 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1126 * destination is specified.
1127 * @param node [i] The A tag node is specified.
1128 * @return The conversion result is returned.
1131 s_jhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
1137 jhtml = GET_JHTML(pdoc);
1147 * It is a handler who processes the BR tag.
1149 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1150 * destination is specified.
1151 * @param node [i] The BR tag node is specified.
1152 * @return The conversion result is returned.
1155 s_jhtml_start_br_tag(void *pdoc, Node *node)
1162 jhtml = GET_JHTML(pdoc);
1167 /*--------------------------------------------------------------------------*/
1168 /* Get Attributes */
1169 /*--------------------------------------------------------------------------*/
1170 for (attr = qs_get_attr(doc,node);
1172 attr = qs_get_next_attr(doc,attr)) {
1173 char *name = qs_get_attr_name(doc,attr);
1174 char *value = qs_get_attr_value(doc,attr);
1175 if (STRCASEEQ('c','C',"clear",name)) {
1176 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1189 * It is a handler who processes the BR tag.
1191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1192 * destination is specified.
1193 * @param node [i] The BR tag node is specified.
1194 * @return The conversion result is returned.
1197 s_jhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
1199 jhtml_t *jhtml = GET_JHTML(pdoc);
1205 * It is a handler who processes the TR tag.
1207 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1208 * destination is specified.
1209 * @param node [i] The TR tag node is specified.
1210 * @return The conversion result is returned.
1213 s_jhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
1219 jhtml = GET_JHTML(pdoc);
1229 * It is a handler who processes the TR tag.
1231 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1232 * destination is specified.
1233 * @param node [i] The TR tag node is specified.
1234 * @return The conversion result is returned.
1237 s_jhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
1239 jhtml_t *jhtml = GET_JHTML(pdoc);
1245 * It is a handler who processes the FONT tag.
1247 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1248 * destination is specified.
1249 * @param node [i] The FONT tag node is specified.
1250 * @return The conversion result is returned.
1253 s_jhtml_start_font_tag(void *pdoc, Node *node)
1260 jhtml = GET_JHTML(pdoc);
1265 /*--------------------------------------------------------------------------*/
1266 /* Get Attributes */
1267 /*--------------------------------------------------------------------------*/
1268 for (attr = qs_get_attr(doc,node);
1270 attr = qs_get_next_attr(doc,attr)) {
1271 char *name = qs_get_attr_name(doc,attr);
1272 char *value = qs_get_attr_value(doc,attr);
1273 if (STRCASEEQ('c','C',"color",name)) {
1278 else if (STRCASEEQ('s','S',"size",name)) {
1279 /*----------------------------------------------------------------------*/
1281 /*----------------------------------------------------------------------*/
1291 * It is a handler who processes the FONT tag.
1293 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1294 * destination is specified.
1295 * @param node [i] The FONT tag node is specified.
1296 * @return The conversion result is returned.
1299 s_jhtml_end_font_tag(void *pdoc, Node *UNUSED(child))
1305 jhtml = GET_JHTML(pdoc);
1315 * It is a handler who processes the FORM tag.
1317 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1318 * destination is specified.
1319 * @param node [i] The FORM tag node is specified.
1320 * @return The conversion result is returned.
1323 s_jhtml_start_form_tag(void *pdoc, Node *node)
1332 jhtml = GET_JHTML(pdoc);
1337 /*--------------------------------------------------------------------------*/
1338 /* Get Attributes */
1339 /*--------------------------------------------------------------------------*/
1340 for (attr = qs_get_attr(doc,node);
1342 attr = qs_get_next_attr(doc,attr)) {
1343 char *name = qs_get_attr_name(doc,attr);
1344 char *value = qs_get_attr_value(doc,attr);
1345 if (STRCASEEQ('a','A',"action",name)) {
1346 /*----------------------------------------------------------------------*/
1348 /*----------------------------------------------------------------------*/
1352 dc = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1353 if (strcmp(dc, value)) {
1357 else if (STRCASEEQ('m','M',"method",name)) {
1358 /*----------------------------------------------------------------------*/
1360 /*----------------------------------------------------------------------*/
1365 else if (STRCASEEQ('u','U',"utn",name)) {
1366 /*----------------------------------------------------------------------*/
1368 /* It is special only for CHTML. */
1369 /*----------------------------------------------------------------------*/
1374 /*-------------------------------------------------------------------------*/
1376 /*-------------------------------------------------------------------------*/
1380 /*-------------------------------------------------------------------------*/
1381 /* Add cookie parameter */
1382 /*-------------------------------------------------------------------------*/
1383 if (jhtml->cookie && jhtml->cookie->cookie_id && dcflag == 1) {
1384 char *vv = apr_psprintf(doc->buf.pool, "%s<input type='hidden' name='%s' value='%s'>",
1387 chxj_url_decode(r, jhtml->cookie->cookie_id));
1395 * It is a handler who processes the FORM tag.
1397 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1398 * destination is specified.
1399 * @param node [i] The FORM tag node is specified.
1400 * @return The conversion result is returned.
1403 s_jhtml_end_form_tag(void *pdoc, Node *UNUSED(child))
1405 jhtml_t *jhtml = GET_JHTML(pdoc);
1406 Doc *doc = jhtml->doc;
1413 * It is a handler who processes the INPUT tag.
1415 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1416 * destination is specified.
1417 * @param node [i] The INPUT tag node is specified.
1418 * @return The conversion result is returned.
1421 s_jhtml_start_input_tag(void *pdoc, Node *node)
1435 jhtml = GET_JHTML(pdoc);
1448 /*--------------------------------------------------------------------------*/
1449 /* Get Attributes */
1450 /*--------------------------------------------------------------------------*/
1451 type = qs_get_type_attr(doc, node, r);
1452 name = qs_get_name_attr(doc, node, r);
1453 value = qs_get_value_attr(doc,node,r);
1454 istyle = qs_get_istyle_attr(doc,node,r);
1455 max_length = qs_get_maxlength_attr(doc,node,r);
1456 checked = qs_get_checked_attr(doc,node,r);
1457 accesskey = qs_get_accesskey_attr(doc, node, r);
1458 size = qs_get_size_attr(doc, node, r);
1461 if (type && (STRCASEEQ('t','T',"text", type) ||
1462 STRCASEEQ('p','P',"password",type) ||
1463 STRCASEEQ('c','C',"checkbox",type) ||
1464 STRCASEEQ('r','R',"radio", type) ||
1465 STRCASEEQ('h','H',"hidden", type) ||
1466 STRCASEEQ('s','S',"submit", type) ||
1467 STRCASEEQ('r','R',"reset", type))) {
1473 if (size && *size) {
1478 if (name && *name) {
1483 if (value && *value) {
1488 if (accesskey && *accesskey) {
1489 W_L(" accesskey=\"");
1493 if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1494 /*------------------------------------------------------------------------*/
1496 /*------------------------------------------------------------------------*/
1497 if (type && STRCASEEQ('p','P',"password", type) && ! jhtml->entryp->pc_flag ) {
1503 char *vv = chxj_istyle_to_mode(doc->buf.pool,istyle);
1509 else if (type && STRCASEEQ('p','P',"password",type)) {
1514 /*--------------------------------------------------------------------------*/
1515 /* The figure is default for the password. */
1516 /*--------------------------------------------------------------------------*/
1517 if (max_length && *max_length) {
1518 if (chxj_chk_numeric(max_length) == 0) {
1519 W_L(" maxlength=\"");
1534 * It is a handler who processes the INPUT tag.
1536 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1537 * destination is specified.
1538 * @param node [i] The INPUT tag node is specified.
1539 * @return The conversion result is returned.
1542 s_jhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
1544 jhtml_t *jhtml = GET_JHTML(pdoc);
1550 * It is a handler who processes the CENTER tag.
1552 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1553 * destination is specified.
1554 * @param node [i] The CENTER tag node is specified.
1555 * @return The conversion result is returned.
1558 s_jhtml_start_center_tag(void *pdoc, Node *UNUSED(node))
1560 jhtml_t *jhtml = GET_JHTML(pdoc);
1561 Doc *doc = jhtml->doc;
1568 * It is a handler who processes the CENTER tag.
1570 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1571 * destination is specified.
1572 * @param node [i] The CENTER tag node is specified.
1573 * @return The conversion result is returned.
1576 s_jhtml_end_center_tag(void *pdoc, Node *UNUSED(child))
1582 jhtml = GET_JHTML(pdoc);
1592 * It is a handler who processes the li tag.
1594 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1595 * destination is specified.
1596 * @param node [i] The li tag node is specified.
1597 * @return The conversion result is returned.
1600 s_jhtml_start_li_tag(void *pdoc, Node *node)
1607 jhtml = GET_JHTML(pdoc);
1612 /*--------------------------------------------------------------------------*/
1613 /* Get Attributes */
1614 /*--------------------------------------------------------------------------*/
1615 for (attr = qs_get_attr(doc,node);
1617 attr = qs_get_next_attr(doc,attr)) {
1618 char *name = qs_get_attr_name(doc,attr);
1619 char *value = qs_get_attr_value(doc,attr);
1620 if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
1625 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
1637 * It is a handler who processes the li tag.
1639 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1640 * destination is specified.
1641 * @param node [i] The li tag node is specified.
1642 * @return The conversion result is returned.
1645 s_jhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
1651 jhtml = GET_JHTML(pdoc);
1661 * It is a handler who processes the OL tag.
1663 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1664 * destination is specified.
1665 * @param node [i] The OL tag node is specified.
1666 * @return The conversion result is returned.
1669 s_jhtml_start_ol_tag(void *pdoc, Node *UNUSED(node))
1675 jhtml = GET_JHTML(pdoc);
1685 * It is a handler who processes the OL tag.
1687 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1688 * destination is specified.
1689 * @param node [i] The OL tag node is specified.
1690 * @return The conversion result is returned.
1693 s_jhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
1699 jhtml = GET_JHTML(pdoc);
1709 * It is a handler who processes the P tag.
1711 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1712 * destination is specified.
1713 * @param node [i] The P tag node is specified.
1714 * @return The conversion result is returned.
1717 s_jhtml_start_p_tag(void *pdoc, Node *UNUSED(node))
1723 jhtml = GET_JHTML(pdoc);
1733 * It is a handler who processes the P tag.
1735 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1736 * destination is specified.
1737 * @param node [i] The P tag node is specified.
1738 * @return The conversion result is returned.
1741 s_jhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
1743 jhtml_t *jhtml = GET_JHTML(pdoc);
1744 Doc *doc = jhtml->doc;
1752 * It is a handler who processes the PRE tag.
1754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1755 * destination is specified.
1756 * @param node [i] The PRE tag node is specified.
1757 * @return The conversion result is returned.
1760 s_jhtml_start_pre_tag(void *pdoc, Node *UNUSED(node))
1762 jhtml_t *jhtml = GET_JHTML(pdoc);
1763 Doc *doc = jhtml->doc;
1772 * It is a handler who processes the PRE tag.
1774 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1775 * destination is specified.
1776 * @param node [i] The PRE tag node is specified.
1777 * @return The conversion result is returned.
1780 s_jhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
1782 jhtml_t *jhtml = GET_JHTML(pdoc);
1783 Doc *doc = jhtml->doc;
1793 * It is a handler who processes the UL tag.
1795 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1796 * destination is specified.
1797 * @param node [i] The UL tag node is specified.
1798 * @return The conversion result is returned.
1801 s_jhtml_start_ul_tag(void *pdoc, Node *UNUSED(node))
1803 jhtml_t *jhtml = GET_JHTML(pdoc);
1804 Doc *doc = jhtml->doc;
1812 * It is a handler who processes the UL tag.
1814 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1815 * destination is specified.
1816 * @param node [i] The UL tag node is specified.
1817 * @return The conversion result is returned.
1820 s_jhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
1822 jhtml_t *jhtml = GET_JHTML(pdoc);
1823 Doc *doc = jhtml->doc;
1831 * It is a handler who processes the HR tag.
1833 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1834 * destination is specified.
1835 * @param node [i] The HR tag node is specified.
1836 * @return The conversion result is returned.
1839 s_jhtml_start_hr_tag(void *pdoc, Node *node)
1841 jhtml_t *jhtml = GET_JHTML(pdoc);
1842 Doc *doc = jhtml->doc;
1846 for (attr = qs_get_attr(doc,node);
1848 attr = qs_get_next_attr(doc,attr)) {
1849 char *name = qs_get_attr_name(doc,attr);
1850 char *value = qs_get_attr_value(doc,attr);
1851 if (STRCASEEQ('a','A',"align",name)) {
1852 /*----------------------------------------------------------------------*/
1854 /*----------------------------------------------------------------------*/
1855 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1861 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1862 /*----------------------------------------------------------------------*/
1864 /*----------------------------------------------------------------------*/
1869 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
1870 /*----------------------------------------------------------------------*/
1872 /*----------------------------------------------------------------------*/
1877 else if (STRCASEEQ('n','N',"noshade",name)) {
1878 /*----------------------------------------------------------------------*/
1880 /*----------------------------------------------------------------------*/
1883 else if (STRCASEEQ('c','C',"color",name) && value && *value) {
1884 /*----------------------------------------------------------------------*/
1886 /*----------------------------------------------------------------------*/
1898 * It is a handler who processes the HR tag.
1900 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1901 * destination is specified.
1902 * @param node [i] The HR tag node is specified.
1903 * @return The conversion result is returned.
1906 s_jhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
1908 jhtml_t *jhtml = GET_JHTML(pdoc);
1914 * It is a handler who processes the IMG tag.
1916 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1917 * destination is specified.
1918 * @param node [i] The IMG tag node is specified.
1919 * @return The conversion result is returned.
1922 s_jhtml_start_img_tag(void *pdoc, Node *node)
1924 jhtml_t *jhtml = GET_JHTML(pdoc);
1925 Doc *doc = jhtml->doc;
1926 request_rec *r = doc->r;
1928 #ifndef IMG_NOT_CONVERT_FILENAME
1929 device_table *spec = jhtml->spec;
1933 /*--------------------------------------------------------------------------*/
1934 /* Get Attributes */
1935 /*--------------------------------------------------------------------------*/
1936 for (attr = qs_get_attr(doc,node);
1938 attr = qs_get_next_attr(doc,attr)) {
1939 char *name = qs_get_attr_name(doc,attr);
1940 char *value = qs_get_attr_value(doc,attr);
1941 if (STRCASEEQ('s','S',"src",name)) {
1942 /*----------------------------------------------------------------------*/
1944 /*----------------------------------------------------------------------*/
1945 #ifdef IMG_NOT_CONVERT_FILENAME
1946 value = chxj_encoding_parameter(r, value);
1947 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1949 value = apr_psprintf(r->pool,
1952 (strchr(value, '?')) ? '&' : '?',
1953 CHXJ_COOKIE_NOUPDATE_PARAM);
1959 value = chxj_img_conv(r, spec, value);
1960 value = chxj_encoding_parameter(r, value);
1961 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1963 value = apr_psprintf(r->pool,
1966 (strchr(value, '?')) ? '&' : '?',
1967 CHXJ_COOKIE_NOUPDATE_PARAM);
1974 else if (STRCASEEQ('a','A',"align",name)) {
1975 /*----------------------------------------------------------------------*/
1977 /*----------------------------------------------------------------------*/
1978 if (value && (STRCASEEQ('t','T',"top", value) ||
1979 STRCASEEQ('m','M',"middle",value) ||
1980 STRCASEEQ('b','B',"bottom",value) ||
1981 STRCASEEQ('l','L',"left", value) ||
1982 STRCASEEQ('r','R',"right", value))) {
1988 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
1989 /*----------------------------------------------------------------------*/
1991 /*----------------------------------------------------------------------*/
1996 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
1997 /*----------------------------------------------------------------------*/
1999 /*----------------------------------------------------------------------*/
2004 else if (STRCASEEQ('h','H',"hspace",name)) {
2005 /*----------------------------------------------------------------------*/
2007 /*----------------------------------------------------------------------*/
2010 else if (STRCASEEQ('v','V',"vspace",name)) {
2011 /*----------------------------------------------------------------------*/
2013 /*----------------------------------------------------------------------*/
2016 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2017 /*----------------------------------------------------------------------*/
2019 /*----------------------------------------------------------------------*/
2031 * It is a handler who processes the IMG tag.
2033 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2034 * destination is specified.
2035 * @param node [i] The IMG tag node is specified.
2036 * @return The conversion result is returned.
2039 s_jhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
2041 jhtml_t *jhtml = GET_JHTML(pdoc);
2047 * It is a handler who processes the SELECT tag.
2049 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2050 * destination is specified.
2051 * @param node [i] The SELECT tag node is specified.
2052 * @return The conversion result is returned.
2055 s_jhtml_start_select_tag(void *pdoc, Node *child)
2057 jhtml_t *jhtml = GET_JHTML(pdoc);
2058 Doc *doc = jhtml->doc;
2065 for (attr = qs_get_attr(doc,child);
2067 attr = qs_get_next_attr(doc,attr)) {
2068 char *nm = qs_get_attr_name(doc,attr);
2069 char *val = qs_get_attr_value(doc,attr);
2070 if (STRCASEEQ('s','S',"size",nm)) {
2071 /*----------------------------------------------------------------------*/
2072 /* CHTML 1.0 version 2.0 */
2073 /*----------------------------------------------------------------------*/
2074 size = apr_pstrdup(doc->buf.pool, val);
2076 else if (STRCASEEQ('n','N',"name",nm)) {
2077 /*----------------------------------------------------------------------*/
2078 /* CHTML 1.0 version 2.0 */
2079 /*----------------------------------------------------------------------*/
2080 name = apr_pstrdup(doc->buf.pool, val);
2082 else if (STRCASEEQ('m','M',"multiple",nm)) {
2083 /*----------------------------------------------------------------------*/
2084 /* CHTML 1.0 version 2.0 */
2085 /*----------------------------------------------------------------------*/
2106 * It is a handler who processes the SELECT tag.
2108 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2109 * destination is specified.
2110 * @param node [i] The SELECT tag node is specified.
2111 * @return The conversion result is returned.
2114 s_jhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
2116 jhtml_t *jhtml = GET_JHTML(pdoc);
2117 Doc *doc = jhtml->doc;
2124 * It is a handler who processes the OPTION tag.
2126 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2127 * destination is specified.
2128 * @param node [i] The OPTION tag node is specified.
2129 * @return The conversion result is returned.
2132 s_jhtml_start_option_tag(void *pdoc, Node *child)
2134 jhtml_t *jhtml = GET_JHTML(pdoc);
2135 Doc *doc = jhtml->doc;
2138 char *selected = NULL;
2142 for (attr = qs_get_attr(doc,child);
2144 attr = qs_get_next_attr(doc,attr)) {
2145 char *nm = qs_get_attr_name(doc,attr);
2146 char *val = qs_get_attr_value(doc,attr);
2147 if (STRCASEEQ('s','S',"selected",nm)) {
2148 /*----------------------------------------------------------------------*/
2149 /* CHTML 1.0 version 2.0 */
2150 /*----------------------------------------------------------------------*/
2151 selected = apr_pstrdup(doc->buf.pool, val);
2153 else if (STRCASEEQ('v','V',"value",nm)) {
2154 /*----------------------------------------------------------------------*/
2155 /* CHTML 1.0 version 2.0 */
2156 /*----------------------------------------------------------------------*/
2157 value = apr_pstrdup(doc->buf.pool, val);
2179 * It is a handler who processes the OPTION tag.
2181 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2182 * destination is specified.
2183 * @param node [i] The OPTION tag node is specified.
2184 * @return The conversion result is returned.
2187 s_jhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
2189 jhtml_t *jhtml = GET_JHTML(pdoc);
2196 * It is a handler who processes the DIV tag.
2198 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2199 * destination is specified.
2200 * @param node [i] The DIV tag node is specified.
2201 * @return The conversion result is returned.
2204 s_jhtml_start_div_tag(void *pdoc, Node *child)
2212 jhtml = GET_JHTML(pdoc);
2217 for (attr = qs_get_attr(doc,child);
2219 attr = qs_get_next_attr(doc,attr)) {
2220 char *nm = qs_get_attr_name(doc,attr);
2221 char *val = qs_get_attr_value(doc,attr);
2222 if (STRCASEEQ('a','A',"align",nm)) {
2223 /*----------------------------------------------------------------------*/
2224 /* CHTML 1.0 (W3C version 3.2) */
2225 /*----------------------------------------------------------------------*/
2226 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2227 align = apr_pstrdup(doc->buf.pool, val);
2242 * It is a handler who processes the DIV tag.
2244 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2245 * destination is specified.
2246 * @param node [i] The DIV tag node is specified.
2247 * @return The conversion result is returned.
2250 s_jhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
2256 jhtml = GET_JHTML(pdoc);
2266 chxj_istyle_to_mode(apr_pool_t *p, const char *s)
2272 case '1': return apr_psprintf(p, "hiragana");
2273 case '2': return apr_psprintf(p, "hankakukana");
2274 case '3': return apr_psprintf(p, "alphabet");
2275 case '4': return apr_psprintf(p, "numeric");
2277 tmp = apr_palloc(p, 1);
2279 return apr_pstrdup(p, tmp);
2283 tmp = apr_palloc(p, 1);
2285 return apr_pstrdup(p,tmp);
2290 s_jhtml_chxjif_tag(void *pdoc, Node *node)
2297 jhtml = GET_JHTML(pdoc);
2301 for (child = qs_get_child_node(doc, node);
2303 child = qs_get_next_node(doc, child)) {
2305 s_jhtml_chxjif_tag(jhtml, child);
2312 * It is a handler who processes the TEXTARE tag.
2314 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2315 * destination is specified.
2316 * @param node [i] The TEXTAREA tag node is specified.
2317 * @return The conversion result is returned.
2320 s_jhtml_start_textarea_tag(void* pdoc, Node* node)
2327 jhtml = GET_JHTML(pdoc);
2331 jhtml->textarea_flag++;
2333 for (attr = qs_get_attr(doc,node);
2335 attr = qs_get_next_attr(doc,attr)) {
2340 name = qs_get_attr_name(doc,attr);
2341 value = qs_get_attr_value(doc,attr);
2343 if (STRCASEEQ('n','N',"name",name)) {
2348 else if (STRCASEEQ('r','R',"rows",name)) {
2353 else if (STRCASEEQ('c','C',"cols",name)) {
2365 * It is a handler who processes the TEXTAREA tag.
2367 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2368 * destination is specified.
2369 * @param node [i] The TEXTAREA tag node is specified.
2370 * @return The conversion result is returned.
2373 s_jhtml_end_textarea_tag(void* pdoc, Node* UNUSED(child))
2379 jhtml = GET_JHTML(pdoc);
2383 W_L("</textarea>\r\n");
2384 jhtml->textarea_flag--;
2391 * It is a handler who processes the B tag.
2393 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2394 * destination is specified.
2395 * @param node [i] The B tag node is specified.
2396 * @return The conversion result is returned.
2399 s_jhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
2405 jhtml = GET_JHTML(pdoc);
2415 * It is a handler who processes the B tag.
2417 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2418 * destination is specified.
2419 * @param node [i] The B tag node is specified.
2420 * @return The conversion result is returned.
2423 s_jhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
2425 jhtml_t* jhtml = GET_JHTML(pdoc);
2426 Doc* doc = jhtml->doc;
2433 s_jhtml_text_tag(void* pdoc, Node* child)
2445 jhtml = GET_JHTML(pdoc);
2449 textval = qs_get_node_value(doc,child);
2450 textval = qs_trim_string(doc->buf.pool, textval);
2451 if (strlen(textval) == 0)
2454 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2455 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2457 tdst = qs_alloc_zero_byte_string(r);
2458 memset(one_byte, 0, sizeof(one_byte));
2461 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2463 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
2465 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2470 if (is_sjis_kanji(textval[ii])) {
2471 one_byte[0] = textval[ii+0];
2472 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2473 one_byte[0] = textval[ii+1];
2474 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2478 if (jhtml->pre_flag) {
2479 one_byte[0] = textval[ii+0];
2480 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2483 if (jhtml->textarea_flag) {
2484 one_byte[0] = textval[ii+0];
2485 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2488 if (textval[ii] != '\r' && textval[ii] != '\n') {
2489 one_byte[0] = textval[ii+0];
2490 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2500 * It is a handler who processes the BLOCKQUOTE tag.
2502 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2503 * destination is specified.
2504 * @param node [i] The BLOCKQUOTE tag node is specified.
2505 * @return The conversion result is returned.
2508 s_jhtml_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2510 jhtml_t *jhtml = GET_JHTML(pdoc);
2511 Doc *doc = jhtml->doc;
2512 W_L("<blockquote>");
2518 * It is a handler who processes the BLOCKQUOTE tag.
2520 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2521 * destination is specified.
2522 * @param node [i] The BLOCKQUOTE tag node is specified.
2523 * @return The conversion result is returned.
2526 s_jhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2528 jhtml_t *jhtml = GET_JHTML(pdoc);
2529 Doc *doc = jhtml->doc;
2530 W_L("</blockquote>");
2536 * It is a handler who processes the DIR tag.
2538 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2539 * destination is specified.
2540 * @param node [i] The DIR tag node is specified.
2541 * @return The conversion result is returned.
2544 s_jhtml_start_dir_tag(void *pdoc, Node *UNUSED(child))
2546 jhtml_t *jhtml = GET_JHTML(pdoc);
2547 Doc *doc = jhtml->doc;
2554 * It is a handler who processes the DIR tag.
2556 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2557 * destination is specified.
2558 * @param node [i] The DIR tag node is specified.
2559 * @return The conversion result is returned.
2562 s_jhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
2564 jhtml_t *jhtml = GET_JHTML(pdoc);
2565 Doc *doc = jhtml->doc;
2572 * It is a handler who processes the DL tag.
2574 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2575 * destination is specified.
2576 * @param node [i] The DL tag node is specified.
2577 * @return The conversion result is returned.
2580 s_jhtml_start_dl_tag(void *pdoc, Node *UNUSED(child))
2582 jhtml_t *jhtml = GET_JHTML(pdoc);
2583 Doc *doc = jhtml->doc;
2590 * It is a handler who processes the DL tag.
2592 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2593 * destination is specified.
2594 * @param node [i] The DL tag node is specified.
2595 * @return The conversion result is returned.
2598 s_jhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
2600 jhtml_t *jhtml = GET_JHTML(pdoc);
2601 Doc *doc = jhtml->doc;
2608 * It is a handler who processes the DT tag.
2610 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2611 * destination is specified.
2612 * @param node [i] The DT tag node is specified.
2613 * @return The conversion result is returned.
2616 s_jhtml_start_dt_tag(void *pdoc, Node *UNUSED(child))
2618 jhtml_t *jhtml = GET_JHTML(pdoc);
2619 Doc *doc = jhtml->doc;
2626 * It is a handler who processes the DT tag.
2628 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2629 * destination is specified.
2630 * @param node [i] The DT tag node is specified.
2631 * @return The conversion result is returned.
2634 s_jhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
2636 jhtml_t *jhtml = GET_JHTML(pdoc);
2642 * It is a handler who processes the DD tag.
2644 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2645 * destination is specified.
2646 * @param node [i] The DD tag node is specified.
2647 * @return The conversion result is returned.
2650 s_jhtml_start_dd_tag(void *pdoc, Node *UNUSED(child))
2652 jhtml_t *jhtml = GET_JHTML(pdoc);
2653 Doc *doc = jhtml->doc;
2660 * It is a handler who processes the DD tag.
2662 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2663 * destination is specified.
2664 * @param node [i] The DD tag node is specified.
2665 * @return The conversion result is returned.
2668 s_jhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
2670 jhtml_t *jhtml = GET_JHTML(pdoc);
2676 * It is a handler who processes the H1 tag.
2678 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2679 * destination is specified.
2680 * @param node [i] The H1 tag node is specified.
2681 * @return The conversion result is returned.
2684 s_jhtml_start_h1_tag(void *pdoc, Node *node)
2692 jhtml = GET_JHTML(pdoc);
2696 for (attr = qs_get_attr(doc,node);
2698 attr = qs_get_next_attr(doc,attr)) {
2701 name = qs_get_attr_name(doc,attr);
2702 value = qs_get_attr_value(doc,attr);
2703 if (STRCASEEQ('a','A',"align", name)) {
2704 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2705 jhtml->h1_align_flag++;
2706 align = apr_pstrdup(doc->buf.pool, value);
2712 W_L("<div align=\"");
2721 * It is a handler who processes the H1 tag.
2723 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2724 * destination is specified.
2725 * @param node [i] The H1 tag node is specified.
2726 * @return The conversion result is returned.
2729 s_jhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
2735 jhtml = GET_JHTML(pdoc);
2739 if (jhtml->h1_align_flag) {
2740 jhtml->h1_align_flag--;
2748 * It is a handler who processes the H2 tag.
2750 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2751 * destination is specified.
2752 * @param node [i] The H1 tag node is specified.
2753 * @return The conversion result is returned.
2756 s_jhtml_start_h2_tag(void *pdoc, Node *node)
2764 jhtml = GET_JHTML(pdoc);
2768 for (attr = qs_get_attr(doc,node);
2770 attr = qs_get_next_attr(doc,attr)) {
2773 name = qs_get_attr_name(doc,attr);
2774 value = qs_get_attr_value(doc,attr);
2775 if (STRCASEEQ('a','A',"align", name)) {
2776 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2777 jhtml->h2_align_flag++;
2778 align = apr_pstrdup(doc->buf.pool, value);
2784 W_L("<div align=\"");
2793 * It is a handler who processes the H2 tag.
2795 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2796 * destination is specified.
2797 * @param node [i] The H1 tag node is specified.
2798 * @return The conversion result is returned.
2801 s_jhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
2807 jhtml = GET_JHTML(pdoc);
2811 if (jhtml->h2_align_flag) {
2812 jhtml->h2_align_flag--;
2820 * It is a handler who processes the H3 tag.
2822 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2823 * destination is specified.
2824 * @param node [i] The H1 tag node is specified.
2825 * @return The conversion result is returned.
2828 s_jhtml_start_h3_tag(void *pdoc, Node *node)
2836 jhtml = GET_JHTML(pdoc);
2840 for (attr = qs_get_attr(doc,node);
2842 attr = qs_get_next_attr(doc,attr)) {
2845 name = qs_get_attr_name(doc,attr);
2846 value = qs_get_attr_value(doc,attr);
2847 if (STRCASEEQ('a','A',"align", name)) {
2848 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2849 jhtml->h3_align_flag++;
2850 align = apr_pstrdup(doc->buf.pool, value);
2856 W_L("<div align=\"");
2865 * It is a handler who processes the H3 tag.
2867 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2868 * destination is specified.
2869 * @param node [i] The H1 tag node is specified.
2870 * @return The conversion result is returned.
2873 s_jhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
2879 jhtml = GET_JHTML(pdoc);
2883 if (jhtml->h3_align_flag) {
2884 jhtml->h3_align_flag--;
2892 * It is a handler who processes the H4 tag.
2894 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2895 * destination is specified.
2896 * @param node [i] The H1 tag node is specified.
2897 * @return The conversion result is returned.
2900 s_jhtml_start_h4_tag(void *pdoc, Node *node)
2908 jhtml = GET_JHTML(pdoc);
2912 for (attr = qs_get_attr(doc,node);
2914 attr = qs_get_next_attr(doc,attr)) {
2917 name = qs_get_attr_name(doc,attr);
2918 value = qs_get_attr_value(doc,attr);
2919 if (STRCASEEQ('a','A',"align", name)) {
2920 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2921 jhtml->h4_align_flag++;
2922 align = apr_pstrdup(doc->buf.pool, value);
2928 W_L("<div align=\"");
2937 * It is a handler who processes the H4 tag.
2939 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2940 * destination is specified.
2941 * @param node [i] The H1 tag node is specified.
2942 * @return The conversion result is returned.
2945 s_jhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
2951 jhtml = GET_JHTML(pdoc);
2955 if (jhtml->h4_align_flag) {
2956 jhtml->h4_align_flag--;
2964 * It is a handler who processes the H5 tag.
2966 * @param pdoc [i/o] The pointer to the JHTML structure at the output
2967 * destination is specified.
2968 * @param node [i] The H1 tag node is specified.
2969 * @return The conversion result is returned.
2972 s_jhtml_start_h5_tag(void *pdoc, Node *node)
2980 jhtml = GET_JHTML(pdoc);
2984 for (attr = qs_get_attr(doc,node);
2986 attr = qs_get_next_attr(doc,attr)) {
2989 name = qs_get_attr_name(doc,attr);
2990 value = qs_get_attr_value(doc,attr);
2991 if (STRCASEEQ('a','A',"align", name)) {
2992 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
2993 jhtml->h5_align_flag++;
2994 align = apr_pstrdup(doc->buf.pool, value);
3000 W_L("<div align=\"");
3009 * It is a handler who processes the H5 tag.
3011 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3012 * destination is specified.
3013 * @param node [i] The H1 tag node is specified.
3014 * @return The conversion result is returned.
3017 s_jhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
3023 jhtml = GET_JHTML(pdoc);
3027 if (jhtml->h5_align_flag) {
3028 jhtml->h5_align_flag--;
3036 * It is a handler who processes the H6 tag.
3038 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3039 * destination is specified.
3040 * @param node [i] The H1 tag node is specified.
3041 * @return The conversion result is returned.
3044 s_jhtml_start_h6_tag(void *pdoc, Node *node)
3052 jhtml = GET_JHTML(pdoc);
3056 for (attr = qs_get_attr(doc,node);
3058 attr = qs_get_next_attr(doc,attr)) {
3061 name = qs_get_attr_name(doc,attr);
3062 value = qs_get_attr_value(doc,attr);
3063 if (STRCASEEQ('a','A',"align", name)) {
3064 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3065 jhtml->h6_align_flag++;
3066 align = apr_pstrdup(doc->buf.pool, value);
3072 W_L("<div align=\"");
3081 * It is a handler who processes the H6 tag.
3083 * @param pdoc [i/o] The pointer to the JHTML structure at the output
3084 * destination is specified.
3085 * @param node [i] The H1 tag node is specified.
3086 * @return The conversion result is returned.
3089 s_jhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
3095 jhtml = GET_JHTML(pdoc);
3099 if (jhtml->h6_align_flag) {
3100 jhtml->h6_align_flag--;