2 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3 * Copyright (C) 2005 Atsushi Konno 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"
24 #define GET_JHTML(X) ((jhtml_t*)(X))
26 static char* s_jhtml_start_html_tag (void* pdoc, Node* node);
27 static char* s_jhtml_end_html_tag (void* pdoc, Node* node);
28 static char* s_jhtml_start_meta_tag (void* pdoc, Node* node);
29 static char* s_jhtml_end_meta_tag (void* pdoc, Node* node);
30 static char* s_jhtml_start_head_tag (void* pdoc, Node* node);
31 static char* s_jhtml_end_head_tag (void* pdoc, Node* node);
32 static char* s_jhtml_start_title_tag (void* pdoc, Node* node);
33 static char* s_jhtml_end_title_tag (void* pdoc, Node* node);
34 static char* s_jhtml_start_base_tag (void* pdoc, Node* node);
35 static char* s_jhtml_end_base_tag (void* pdoc, Node* node);
36 static char* s_jhtml_start_body_tag (void* pdoc, Node* node);
37 static char* s_jhtml_end_body_tag (void* pdoc, Node* node);
38 static char* s_jhtml_start_a_tag (void* pdoc, Node* node);
39 static char* s_jhtml_end_a_tag (void* pdoc, Node* node);
40 static char* s_jhtml_start_pre_tag (void* pdoc, Node* node);
41 static char* s_jhtml_end_pre_tag (void* pdoc, Node* node);
42 static char* s_jhtml_start_p_tag (void* pdoc, Node* node);
43 static char* s_jhtml_end_p_tag (void* pdoc, Node* node);
44 static char* s_jhtml_start_ul_tag (void* pdoc, Node* node);
45 static char* s_jhtml_end_ul_tag (void* pdoc, Node* node);
46 static char* s_jhtml_start_ol_tag (void* pdoc, Node* node);
47 static char* s_jhtml_end_ol_tag (void* pdoc, Node* node);
48 static char* s_jhtml_start_li_tag (void* pdoc, Node* node);
49 static char* s_jhtml_end_li_tag (void* pdoc, Node* node);
50 static char* s_jhtml_start_br_tag (void* pdoc, Node* node);
51 static char* s_jhtml_end_br_tag (void* pdoc, Node* node);
52 static char* s_jhtml_start_tr_tag (void* pdoc, Node* node);
53 static char* s_jhtml_end_tr_tag (void* pdoc, Node* node);
54 static char* s_jhtml_start_font_tag (void* pdoc, Node* node);
55 static char* s_jhtml_end_font_tag (void* pdoc, Node* node);
56 static char* s_jhtml_start_form_tag (void* pdoc, Node* node);
57 static char* s_jhtml_end_form_tag (void* pdoc, Node* node);
58 static char* s_jhtml_start_input_tag (void* pdoc, Node* node);
59 static char* s_jhtml_end_input_tag (void* pdoc, Node* node);
60 static char* s_jhtml_start_center_tag (void* pdoc, Node* node);
61 static char* s_jhtml_end_center_tag (void* pdoc, Node* node);
62 static char* s_jhtml_start_hr_tag (void* pdoc, Node* node);
63 static char* s_jhtml_end_hr_tag (void* pdoc, Node* node);
64 static char* s_jhtml_start_img_tag (void* pdoc, Node* node);
65 static char* s_jhtml_end_img_tag (void* pdoc, Node* node);
66 static char* s_jhtml_start_select_tag (void* pdoc, Node* node);
67 static char* s_jhtml_end_select_tag (void* pdoc, Node* node);
68 static char* s_jhtml_start_option_tag (void* pdoc, Node* node);
69 static char* s_jhtml_end_option_tag (void* pdoc, Node* node);
70 static char* s_jhtml_start_div_tag (void* pdoc, Node* node);
71 static char* s_jhtml_end_div_tag (void* pdoc, Node* node);
72 static char* s_jhtml_start_textarea_tag (void* pdoc, Node* node);
73 static char* s_jhtml_end_textarea_tag (void* pdoc, Node* node);
74 static char* s_jhtml_start_b_tag (void* pdoc, Node* node);
75 static char* s_jhtml_end_b_tag (void* pdoc, Node* node);
76 static char* s_jhtml_chxjif_tag (void* pdoc, Node* node);
77 static char* s_jhtml_text_tag (void* pdoc, Node* node);
79 static void s_init_jhtml(jhtml_t* jhtml, Doc* doc, request_rec* r, device_table* spec);
81 static int s_jhtml_search_emoji(jhtml_t* jhtml, char* txt, char** rslt);
83 static char* chxj_istyle_to_mode(request_rec* r, const char* s);
87 tag_handler jhtml_handler[] = {
90 s_jhtml_start_html_tag,
95 s_jhtml_start_meta_tag,
100 s_jhtml_start_textarea_tag,
101 s_jhtml_end_textarea_tag,
110 s_jhtml_start_pre_tag,
115 s_jhtml_start_ul_tag,
120 s_jhtml_start_li_tag,
125 s_jhtml_start_ol_tag,
160 s_jhtml_start_head_tag,
161 s_jhtml_end_head_tag,
165 s_jhtml_start_title_tag,
166 s_jhtml_end_title_tag,
170 s_jhtml_start_base_tag,
171 s_jhtml_end_base_tag,
175 s_jhtml_start_body_tag,
176 s_jhtml_end_body_tag,
185 s_jhtml_start_br_tag,
195 s_jhtml_start_tr_tag,
210 s_jhtml_start_font_tag,
211 s_jhtml_end_font_tag,
215 s_jhtml_start_form_tag,
216 s_jhtml_end_form_tag,
220 s_jhtml_start_input_tag,
221 s_jhtml_end_input_tag,
225 s_jhtml_start_center_tag,
226 s_jhtml_end_center_tag,
230 s_jhtml_start_hr_tag,
235 s_jhtml_start_img_tag,
240 s_jhtml_start_select_tag,
241 s_jhtml_end_select_tag,
245 s_jhtml_start_option_tag,
246 s_jhtml_end_option_tag,
250 s_jhtml_start_div_tag,
302 * converts from CHTML5.0 to JHTML.
304 * @param r [i] Requet_rec is appointed.
305 * @param spec [i] The result of the device specification processing which
306 * was done in advance is appointed.
307 * @param src [i] The character string before the converting is appointed.
308 * @return The character string after the converting is returned.
317 chxjconvrule_entry* entryp,
328 /*--------------------------------------------------------------------------*/
330 /*--------------------------------------------------------------------------*/
332 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
334 DBG(r,"I found qrcode xml");
337 DBG(r,"not found qrcode xml");
339 /*--------------------------------------------------------------------------*/
340 /* The CHTML structure is initialized. */
341 /*--------------------------------------------------------------------------*/
342 s_init_jhtml(&jhtml, &doc, r, spec);
344 jhtml.entryp = entryp;
345 jhtml.cookie = cookie;
347 ap_set_content_type(r, "text/html; charset=Windows-31J");
349 /*--------------------------------------------------------------------------*/
350 /* The character string of the input is analyzed. */
351 /*--------------------------------------------------------------------------*/
352 qs_init_malloc(&doc);
353 qs_init_root_node(&doc);
355 ss = apr_pcalloc(r->pool, srclen + 1);
357 memset(ss, 0, srclen + 1);
358 memcpy(ss, src, srclen);
361 chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
364 qs_parse_string(&doc,ss,strlen(ss));
366 /*--------------------------------------------------------------------------*/
367 /* It converts it from CHTML to JHTML. */
368 /*--------------------------------------------------------------------------*/
369 chxj_node_exchange(spec,r,(void*)&jhtml, &doc, qs_get_root(&doc), 0);
372 qs_all_free(&doc,QX_LOGMARK);
375 return apr_pstrdup(r->pool,ss);
378 dst = apr_psprintf(r->pool, "\n");
380 *dstlen = strlen(dst);
383 chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
391 * The CHTML structure is initialized.
393 * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
394 * initialized is specified.
395 * @param doc [i] The Doc structure that should be set to the initialized
396 * JHTML structure is specified.
397 * @param r [i] To use POOL, the pointer to request_rec is specified.
398 * @param spec [i] The pointer to the device_table
401 s_init_jhtml(jhtml_t* jhtml, Doc* doc, request_rec* r, device_table* spec)
403 memset(doc, 0, sizeof(Doc));
404 memset(jhtml, 0, sizeof(jhtml_t));
409 jhtml->out = qs_alloc_zero_byte_string(r);
410 jhtml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
411 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
416 * Corresponding EMOJI to a current character-code is retrieved.
417 * The substitution character string is stored in the rslt pointer if agreeing.
419 * @param jhtml [i] The pointer to the CHTML structure is specified.
420 * @param txt [i] The character string to want to examine whether it is
421 * EMOJI is specified.
422 * @param rslt [o] The pointer to the pointer that stores the result is
424 * @return When corresponding EMOJI exists, it returns it excluding 0.
427 s_jhtml_search_emoji(jhtml_t* jhtml, char* txt, char** rslt)
439 if (! spec) DBG(r,"spec is NULL");
441 for (ee = jhtml->conf->emoji;
445 unsigned char hex1byte;
446 unsigned char hex2byte;
449 DBG(r,"emoji->imode is NULL");
453 hex1byte = ee->imode->hex1byte & 0xff;
454 hex2byte = ee->imode->hex2byte & 0xff;
456 if (ee->imode->string
457 && strlen(ee->imode->string) > 0
458 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
459 if (spec == NULL || spec->emoji_type == NULL) {
460 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
461 return strlen(ee->imode->string);
468 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
469 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
470 if (spec == NULL || spec->emoji_type == NULL) {
471 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
484 * It is a handler who processes the HTML tag.
486 * @param pdoc [i/o] The pointer to the CHTML structure at the output
487 * destination is specified.
488 * @param node [i] The HTML tag node is specified.
489 * @return The conversion result is returned.
492 s_jhtml_start_html_tag(void* pdoc, Node* node)
499 jhtml = GET_JHTML(pdoc);
502 DBG(r, "start s_jhtml_start_html_tag()");
504 /*--------------------------------------------------------------------------*/
506 /*--------------------------------------------------------------------------*/
507 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<html>\n", NULL);
509 DBG(r, "end s_jhtml_start_html_tag()");
516 * It is a handler who processes the HTML tag.
518 * @param pdoc [i/o] The pointer to the CHTML structure at the output
519 * destination is specified.
520 * @param node [i] The HTML tag node is specified.
521 * @return The conversion result is returned.
524 s_jhtml_end_html_tag(void* pdoc, Node* child)
526 jhtml_t* jhtml = GET_JHTML(pdoc);
527 Doc* doc = jhtml->doc;
528 request_rec* r = doc->r;
530 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</html>\n", NULL);
537 * It is a handler who processes the META tag.
539 * @param pdoc [i/o] The pointer to the CHTML structure at the output
540 * destination is specified.
541 * @param node [i] The META tag node is specified.
542 * @return The conversion result is returned.
545 s_jhtml_start_meta_tag(void* pdoc, Node* node)
551 int content_type_flag;
554 jhtml = GET_JHTML(pdoc);
558 content_type_flag = 0;
560 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<meta", NULL);
563 /*--------------------------------------------------------------------------*/
565 /*--------------------------------------------------------------------------*/
566 for (attr = qs_get_attr(doc,node);
568 attr = qs_get_next_attr(doc,attr)) {
573 name = qs_get_attr_name(doc,attr);
574 value = qs_get_attr_value(doc,attr);
576 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "http-equiv") == 0) {
577 /*----------------------------------------------------------------------*/
579 /*----------------------------------------------------------------------*/
580 jhtml->out = apr_pstrcat(r->pool,
586 if ((*value == 'c' || *value == 'C')
587 && strcasecmp(value, "content-type") == 0) {
588 content_type_flag = 1;
590 if ((*value == 'r' || *value == 'R')
591 && strcasecmp(value, "refresh") == 0)
595 if ((*name == 'c' || *name == 'C') &&strcasecmp(name, "content") == 0) {
596 /*----------------------------------------------------------------------*/
598 /*----------------------------------------------------------------------*/
599 if (content_type_flag) {
600 jhtml->out = apr_pstrcat(r->pool,
605 "text/html; charset=Windows-31J",
615 buf = apr_pstrdup(r->pool, value);
617 url = strchr(buf, ';');
619 sec = apr_pstrdup(r->pool, buf);
622 url = chxj_encoding_parameter(r, url);
623 url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
624 jhtml->out = apr_pstrcat(r->pool,
637 jhtml->out = apr_pstrcat(r->pool,
648 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
655 * It is a handler who processes the META tag.
657 * @param pdoc [i/o] The pointer to the CHTML structure at the output
658 * destination is specified.
659 * @param node [i] The META tag node is specified.
660 * @return The conversion result is returned.
663 s_jhtml_end_meta_tag(void* pdoc, Node* child)
667 jhtml = GET_JHTML(pdoc);
674 * It is a handler who processes the HEAD tag.
676 * @param pdoc [i/o] The pointer to the CHTML structure at the output
677 * destination is specified.
678 * @param node [i] The HEAD tag node is specified.
679 * @return The conversion result is returned.
682 s_jhtml_start_head_tag(void* pdoc, Node* node)
688 jhtml = GET_JHTML(pdoc);
692 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<head>\r\n", NULL);
699 * It is a handler who processes the HEAD tag.
701 * @param pdoc [i/o] The pointer to the CHTML structure at the output
702 * destination is specified.
703 * @param node [i] The HEAD tag node is specified.
704 * @return The conversion result is returned.
707 s_jhtml_end_head_tag(void* pdoc, Node* child)
713 jhtml = GET_JHTML(pdoc);
717 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</head>\r\n", NULL);
724 * It is a handler who processes the TITLE tag.
726 * @param pdoc [i/o] The pointer to the CHTML structure at the output
727 * destination is specified.
728 * @param node [i] The TITLE tag node is specified.
729 * @return The conversion result is returned.
732 s_jhtml_start_title_tag(void* pdoc, Node* node)
738 jhtml = GET_JHTML(pdoc);
742 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<title>", NULL);
749 * It is a handler who processes the TITLE tag.
751 * @param pdoc [i/o] The pointer to the CHTML structure at the output
752 * destination is specified.
753 * @param node [i] The TITLE tag node is specified.
754 * @return The conversion result is returned.
757 s_jhtml_end_title_tag(void* pdoc, Node* child)
763 jhtml = GET_JHTML(pdoc);
767 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</title>\r\n", NULL);
774 * It is a handler who processes the BASE tag.
776 * @param pdoc [i/o] The pointer to the CHTML structure at the output
777 * destination is specified.
778 * @param node [i] The BASE tag node is specified.
779 * @return The conversion result is returned.
782 s_jhtml_start_base_tag(void* pdoc, Node* node)
789 jhtml = GET_JHTML(pdoc);
793 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<base", NULL);
795 /*--------------------------------------------------------------------------*/
797 /*--------------------------------------------------------------------------*/
798 for (attr = qs_get_attr(doc,node);
800 attr = qs_get_next_attr(doc,attr)) {
805 name = qs_get_attr_name(doc,attr);
806 value = qs_get_attr_value(doc,attr);
808 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
809 jhtml->out = apr_pstrcat(r->pool,
818 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >\r\n", NULL);
825 * It is a handler who processes the BASE tag.
827 * @param pdoc [i/o] The pointer to the CHTML structure at the output
828 * destination is specified.
829 * @param node [i] The BASE tag node is specified.
830 * @return The conversion result is returned.
833 s_jhtml_end_base_tag(void* pdoc, Node* child)
837 jhtml = GET_JHTML(pdoc);
844 * It is a handler who processes the BODY tag.
846 * @param pdoc [i/o] The pointer to the CHTML structure at the output
847 * destination is specified.
848 * @param node [i] The BODY tag node is specified.
849 * @return The conversion result is returned.
852 s_jhtml_start_body_tag(void* pdoc, Node* node)
859 jhtml = GET_JHTML(pdoc);
863 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<body", NULL);
865 /*--------------------------------------------------------------------------*/
867 /*--------------------------------------------------------------------------*/
868 for (attr = qs_get_attr(doc,node);
870 attr = qs_get_next_attr(doc,attr)) {
875 name = qs_get_attr_name(doc,attr);
876 value = qs_get_attr_value(doc,attr);
878 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
879 /*----------------------------------------------------------------------*/
881 /*----------------------------------------------------------------------*/
882 jhtml->out = apr_pstrcat(r->pool,
890 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
891 /*----------------------------------------------------------------------*/
893 /*----------------------------------------------------------------------*/
894 jhtml->out = apr_pstrcat(r->pool,
902 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
903 /*----------------------------------------------------------------------*/
905 /*----------------------------------------------------------------------*/
906 jhtml->out = apr_pstrcat(r->pool,
914 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
915 /*----------------------------------------------------------------------*/
917 /*----------------------------------------------------------------------*/
921 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
922 /*----------------------------------------------------------------------*/
924 /*----------------------------------------------------------------------*/
929 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\r\n", NULL);
936 * It is a handler who processes the BODY tag.
938 * @param pdoc [i/o] The pointer to the CHTML structure at the output
939 * destination is specified.
940 * @param node [i] The BODY tag node is specified.
941 * @return The conversion result is returned.
944 s_jhtml_end_body_tag(void* pdoc, Node* child)
950 jhtml = GET_JHTML(pdoc);
954 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</body>\r\n", NULL);
961 * It is a handler who processes the A tag.
963 * @param pdoc [i/o] The pointer to the CHTML structure at the output
964 * destination is specified.
965 * @param node [i] The A tag node is specified.
966 * @return The conversion result is returned.
969 s_jhtml_start_a_tag(void* pdoc, Node* node)
976 jhtml = GET_JHTML(pdoc);
980 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<a", NULL);
982 /*--------------------------------------------------------------------------*/
984 /*--------------------------------------------------------------------------*/
985 for (attr = qs_get_attr(doc,node);
987 attr = qs_get_next_attr(doc,attr)) {
992 name = qs_get_attr_name(doc,attr);
993 value = qs_get_attr_value(doc,attr);
995 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
996 /*----------------------------------------------------------------------*/
998 /*----------------------------------------------------------------------*/
999 jhtml->out = apr_pstrcat(r->pool,
1007 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1008 /*----------------------------------------------------------------------*/
1010 /*----------------------------------------------------------------------*/
1011 value = chxj_encoding_parameter(r, value);
1012 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1013 jhtml->out = apr_pstrcat(r->pool,
1021 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1022 /*----------------------------------------------------------------------*/
1024 /*----------------------------------------------------------------------*/
1025 jhtml->out = apr_pstrcat(r->pool,
1033 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
1034 /*----------------------------------------------------------------------*/
1036 /*----------------------------------------------------------------------*/
1037 jhtml->out = apr_pstrcat(r->pool,
1045 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
1046 /*----------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------*/
1052 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1053 /*----------------------------------------------------------------------*/
1055 /* It is special only for CHTML. */
1056 /*----------------------------------------------------------------------*/
1057 jhtml->out = apr_pstrcat(r->pool,
1063 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1064 /*----------------------------------------------------------------------*/
1066 /*----------------------------------------------------------------------*/
1070 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1071 /*----------------------------------------------------------------------*/
1073 /*----------------------------------------------------------------------*/
1077 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1078 /*----------------------------------------------------------------------*/
1080 /*----------------------------------------------------------------------*/
1084 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1085 /*----------------------------------------------------------------------*/
1087 /*----------------------------------------------------------------------*/
1091 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1092 /*----------------------------------------------------------------------*/
1094 /*----------------------------------------------------------------------*/
1098 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1099 /*----------------------------------------------------------------------*/
1101 /*----------------------------------------------------------------------*/
1105 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1106 /*----------------------------------------------------------------------*/
1108 /*----------------------------------------------------------------------*/
1113 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1120 * It is a handler who processes the A tag.
1122 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1123 * destination is specified.
1124 * @param node [i] The A tag node is specified.
1125 * @return The conversion result is returned.
1128 s_jhtml_end_a_tag(void* pdoc, Node* child)
1134 jhtml = GET_JHTML(pdoc);
1138 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</a>", NULL);
1145 * It is a handler who processes the BR tag.
1147 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1148 * destination is specified.
1149 * @param node [i] The BR tag node is specified.
1150 * @return The conversion result is returned.
1153 s_jhtml_start_br_tag(void* pdoc, Node* node)
1159 jhtml = GET_JHTML(pdoc);
1163 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<br>\r\n", NULL);
1170 * It is a handler who processes the BR tag.
1172 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1173 * destination is specified.
1174 * @param node [i] The BR tag node is specified.
1175 * @return The conversion result is returned.
1178 s_jhtml_end_br_tag(void* pdoc, Node* child)
1182 jhtml = GET_JHTML(pdoc);
1189 * It is a handler who processes the TR tag.
1191 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1192 * destination is specified.
1193 * @param node [i] The TR tag node is specified.
1194 * @return The conversion result is returned.
1197 s_jhtml_start_tr_tag(void* pdoc, Node* node)
1203 jhtml = GET_JHTML(pdoc);
1207 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<br>\r\n", NULL);
1214 * It is a handler who processes the TR tag.
1216 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1217 * destination is specified.
1218 * @param node [i] The TR tag node is specified.
1219 * @return The conversion result is returned.
1222 s_jhtml_end_tr_tag(void* pdoc, Node* child)
1226 jhtml = GET_JHTML(pdoc);
1233 * It is a handler who processes the FONT tag.
1235 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1236 * destination is specified.
1237 * @param node [i] The FONT tag node is specified.
1238 * @return The conversion result is returned.
1241 s_jhtml_start_font_tag(void* pdoc, Node* node)
1248 jhtml = GET_JHTML(pdoc);
1252 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<font", NULL);
1254 /*--------------------------------------------------------------------------*/
1255 /* Get Attributes */
1256 /*--------------------------------------------------------------------------*/
1257 for (attr = qs_get_attr(doc,node);
1259 attr = qs_get_next_attr(doc,attr)) {
1264 name = qs_get_attr_name(doc,attr);
1265 value = qs_get_attr_value(doc,attr);
1267 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1268 jhtml->out = apr_pstrcat(r->pool,
1276 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1277 /*----------------------------------------------------------------------*/
1279 /*----------------------------------------------------------------------*/
1284 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
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* child)
1301 jhtml_t* jhtml = GET_JHTML(pdoc);
1302 request_rec* r = jhtml->doc->r;
1304 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</font>", NULL);
1311 * It is a handler who processes the FORM tag.
1313 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1314 * destination is specified.
1315 * @param node [i] The FORM tag node is specified.
1316 * @return The conversion result is returned.
1319 s_jhtml_start_form_tag(void* pdoc, Node* node)
1321 jhtml_t* jhtml = GET_JHTML(pdoc);
1322 Doc* doc = jhtml->doc;
1323 request_rec* r = doc->r;
1326 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<form", NULL);
1328 /*--------------------------------------------------------------------------*/
1329 /* Get Attributes */
1330 /*--------------------------------------------------------------------------*/
1331 for (attr = qs_get_attr(doc,node);
1333 attr = qs_get_next_attr(doc,attr)) {
1334 char* name = qs_get_attr_name(doc,attr);
1335 char* value = qs_get_attr_value(doc,attr);
1337 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1338 /*----------------------------------------------------------------------*/
1340 /*----------------------------------------------------------------------*/
1341 jhtml->out = apr_pstrcat(r->pool,
1349 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "method") == 0) {
1350 /*----------------------------------------------------------------------*/
1352 /*----------------------------------------------------------------------*/
1353 jhtml->out = apr_pstrcat(r->pool,
1361 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1362 /*----------------------------------------------------------------------*/
1364 /* It is special only for CHTML. */
1365 /*----------------------------------------------------------------------*/
1366 jhtml->out = apr_pstrcat(r->pool,
1373 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1375 if (jhtml->cookie && jhtml->cookie->cookie_id) {
1376 jhtml->out = apr_psprintf(r->pool, "%s<input type='hidden' name='%s' value='%s'>",
1379 jhtml->cookie->cookie_id);
1387 * It is a handler who processes the FORM tag.
1389 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1390 * destination is specified.
1391 * @param node [i] The FORM tag node is specified.
1392 * @return The conversion result is returned.
1395 s_jhtml_end_form_tag(void* pdoc, Node* child)
1397 jhtml_t* jhtml = GET_JHTML(pdoc);
1398 Doc* doc = jhtml->doc;
1399 request_rec* r = doc->r;
1401 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</form>", NULL);
1408 * It is a handler who processes the INPUT tag.
1410 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1411 * destination is specified.
1412 * @param node [i] The INPUT tag node is specified.
1413 * @return The conversion result is returned.
1416 s_jhtml_start_input_tag(void* pdoc, Node* node)
1418 jhtml_t* jhtml = GET_JHTML(pdoc);
1419 Doc* doc = jhtml->doc;
1420 request_rec* r = doc->r;
1421 char* max_length = NULL;
1425 char* istyle = NULL;
1427 char* checked = NULL;
1428 char* accesskey = NULL;
1430 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<input", NULL);
1432 /*--------------------------------------------------------------------------*/
1433 /* Get Attributes */
1434 /*--------------------------------------------------------------------------*/
1436 type = qs_get_type_attr(doc, node, r);
1437 name = qs_get_name_attr(doc, node, r);
1438 value = qs_get_value_attr(doc,node,r);
1439 istyle = qs_get_istyle_attr(doc,node,r);
1440 max_length = qs_get_maxlength_attr(doc,node,r);
1441 checked = qs_get_checked_attr(doc,node,r);
1442 accesskey = qs_get_accesskey_attr(doc, node, r);
1443 size = qs_get_size_attr(doc, node, r);
1446 jhtml->out = apr_pstrcat(r->pool,
1454 jhtml->out = apr_pstrcat(r->pool,
1462 jhtml->out = apr_pstrcat(r->pool,
1470 jhtml->out = apr_pstrcat(r->pool,
1478 jhtml->out = apr_pstrcat(r->pool,
1485 /*------------------------------------------------------------------------*/
1487 /*------------------------------------------------------------------------*/
1488 if (type && (*type == 'p' || *type == 'P') && strcasecmp(type, "password") == 0
1489 && ! jhtml->entryp->pc_flag ) {
1490 jhtml->out = apr_pstrcat(r->pool,
1497 jhtml->out = apr_pstrcat(r->pool,
1500 chxj_istyle_to_mode(r,istyle), "\" ",
1505 if (istyle == NULL && type != NULL && strcasecmp(type, "password") == 0) {
1506 jhtml->out = apr_pstrcat(r->pool,
1512 /*--------------------------------------------------------------------------*/
1513 /* The figure is default for the password. */
1514 /*--------------------------------------------------------------------------*/
1516 jhtml->out = apr_pstrcat(r->pool,
1525 jhtml->out = apr_pstrcat(r->pool,
1526 jhtml->out, " checked ", NULL);
1529 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
1536 * It is a handler who processes the INPUT tag.
1538 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1539 * destination is specified.
1540 * @param node [i] The INPUT tag node is specified.
1541 * @return The conversion result is returned.
1544 s_jhtml_end_input_tag(void* pdoc, Node* child)
1546 jhtml_t* jhtml = GET_JHTML(pdoc);
1553 * It is a handler who processes the CENTER tag.
1555 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1556 * destination is specified.
1557 * @param node [i] The CENTER tag node is specified.
1558 * @return The conversion result is returned.
1561 s_jhtml_start_center_tag(void* pdoc, Node* node)
1563 jhtml_t* jhtml = GET_JHTML(pdoc);
1564 Doc* doc = jhtml->doc;
1565 request_rec* r = doc->r;
1567 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<center>", NULL);
1574 * It is a handler who processes the CENTER tag.
1576 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1577 * destination is specified.
1578 * @param node [i] The CENTER tag node is specified.
1579 * @return The conversion result is returned.
1582 s_jhtml_end_center_tag(void* pdoc, Node* child)
1584 jhtml_t* jhtml = GET_JHTML(pdoc);
1585 Doc* doc = jhtml->doc;
1586 request_rec* r = doc->r;
1588 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</center>", NULL);
1595 * It is a handler who processes the li tag.
1597 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1598 * destination is specified.
1599 * @param node [i] The li tag node is specified.
1600 * @return The conversion result is returned.
1603 s_jhtml_start_li_tag(void* pdoc, Node* node)
1605 jhtml_t* jhtml = GET_JHTML(pdoc);
1606 Doc* doc = jhtml->doc;
1607 request_rec* r = doc->r;
1609 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<li>", NULL);
1616 * It is a handler who processes the li tag.
1618 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1619 * destination is specified.
1620 * @param node [i] The li tag node is specified.
1621 * @return The conversion result is returned.
1624 s_jhtml_end_li_tag(void* pdoc, Node* child)
1626 jhtml_t* jhtml = GET_JHTML(pdoc);
1627 Doc* doc = jhtml->doc;
1628 request_rec* r = doc->r;
1630 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</li>", NULL);
1637 * It is a handler who processes the OL tag.
1639 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1640 * destination is specified.
1641 * @param node [i] The OL tag node is specified.
1642 * @return The conversion result is returned.
1645 s_jhtml_start_ol_tag(void* pdoc, Node* node)
1647 jhtml_t* jhtml = GET_JHTML(pdoc);
1648 Doc* doc = jhtml->doc;
1649 request_rec* r = doc->r;
1651 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ol>", NULL);
1658 * It is a handler who processes the OL tag.
1660 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1661 * destination is specified.
1662 * @param node [i] The OL tag node is specified.
1663 * @return The conversion result is returned.
1666 s_jhtml_end_ol_tag(void* pdoc, Node* child)
1668 jhtml_t* jhtml = GET_JHTML(pdoc);
1669 Doc* doc = jhtml->doc;
1670 request_rec* r = doc->r;
1672 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ol>", NULL);
1679 * It is a handler who processes the P tag.
1681 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1682 * destination is specified.
1683 * @param node [i] The P tag node is specified.
1684 * @return The conversion result is returned.
1687 s_jhtml_start_p_tag(void* pdoc, Node* node)
1689 jhtml_t* jhtml = GET_JHTML(pdoc);
1690 Doc* doc = jhtml->doc;
1691 request_rec* r = doc->r;
1693 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<p>", NULL);
1700 * It is a handler who processes the P tag.
1702 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1703 * destination is specified.
1704 * @param node [i] The P tag node is specified.
1705 * @return The conversion result is returned.
1708 s_jhtml_end_p_tag(void* pdoc, Node* child)
1710 jhtml_t* jhtml = GET_JHTML(pdoc);
1711 Doc* doc = jhtml->doc;
1712 request_rec* r = doc->r;
1714 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</p>", NULL);
1721 * It is a handler who processes the PRE tag.
1723 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1724 * destination is specified.
1725 * @param node [i] The PRE tag node is specified.
1726 * @return The conversion result is returned.
1729 s_jhtml_start_pre_tag(void* pdoc, Node* node)
1731 jhtml_t* jhtml = GET_JHTML(pdoc);
1732 Doc* doc = jhtml->doc;
1733 request_rec* r = doc->r;
1736 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<pre>", NULL);
1743 * It is a handler who processes the PRE tag.
1745 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1746 * destination is specified.
1747 * @param node [i] The PRE tag node is specified.
1748 * @return The conversion result is returned.
1751 s_jhtml_end_pre_tag(void* pdoc, Node* child)
1753 jhtml_t* jhtml = GET_JHTML(pdoc);
1754 Doc* doc = jhtml->doc;
1755 request_rec* r = doc->r;
1757 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</pre>", NULL);
1765 * It is a handler who processes the UL tag.
1767 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1768 * destination is specified.
1769 * @param node [i] The UL tag node is specified.
1770 * @return The conversion result is returned.
1773 s_jhtml_start_ul_tag(void* pdoc, Node* node)
1775 jhtml_t* jhtml = GET_JHTML(pdoc);
1776 Doc* doc = jhtml->doc;
1777 request_rec* r = doc->r;
1779 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ul>", NULL);
1786 * It is a handler who processes the UL tag.
1788 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1789 * destination is specified.
1790 * @param node [i] The UL tag node is specified.
1791 * @return The conversion result is returned.
1794 s_jhtml_end_ul_tag(void* pdoc, Node* child)
1796 jhtml_t* jhtml = GET_JHTML(pdoc);
1797 Doc* doc = jhtml->doc;
1798 request_rec* r = doc->r;
1800 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ul>", NULL);
1807 * It is a handler who processes the HR tag.
1809 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1810 * destination is specified.
1811 * @param node [i] The HR tag node is specified.
1812 * @return The conversion result is returned.
1815 s_jhtml_start_hr_tag(void* pdoc, Node* node)
1817 jhtml_t* jhtml = GET_JHTML(pdoc);
1818 Doc* doc = jhtml->doc;
1819 request_rec* r = doc->r;
1822 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<hr ", NULL);
1824 for (attr = qs_get_attr(doc,node);
1826 attr = qs_get_next_attr(doc,attr)) {
1827 char* name = qs_get_attr_name(doc,attr);
1828 char* value = qs_get_attr_value(doc,attr);
1829 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
1830 /*----------------------------------------------------------------------*/
1832 /*----------------------------------------------------------------------*/
1833 jhtml->out = apr_pstrcat(r->pool,
1835 " align=\"", value, "\" ", NULL);
1838 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1839 /*----------------------------------------------------------------------*/
1841 /*----------------------------------------------------------------------*/
1842 jhtml->out = apr_pstrcat(r->pool,
1844 " size=\"", value, "\" ", NULL);
1847 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width") == 0) {
1848 /*----------------------------------------------------------------------*/
1850 /*----------------------------------------------------------------------*/
1851 jhtml->out = apr_pstrcat(r->pool,
1853 " width=\"", value, "\" ", NULL);
1856 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "noshade") == 0) {
1857 /*----------------------------------------------------------------------*/
1859 /*----------------------------------------------------------------------*/
1860 jhtml->out = apr_pstrcat(r->pool,
1865 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1866 /*----------------------------------------------------------------------*/
1868 /*----------------------------------------------------------------------*/
1872 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
1879 * It is a handler who processes the HR tag.
1881 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1882 * destination is specified.
1883 * @param node [i] The HR tag node is specified.
1884 * @return The conversion result is returned.
1887 s_jhtml_end_hr_tag(void* pdoc, Node* child)
1889 jhtml_t* jhtml = GET_JHTML(pdoc);
1896 * It is a handler who processes the IMG tag.
1898 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1899 * destination is specified.
1900 * @param node [i] The IMG tag node is specified.
1901 * @return The conversion result is returned.
1904 s_jhtml_start_img_tag(void* pdoc, Node* node)
1906 jhtml_t* jhtml = GET_JHTML(pdoc);
1907 Doc* doc = jhtml->doc;
1908 request_rec* r = doc->r;
1910 #ifndef IMG_NOT_CONVERT_FILENAME
1911 device_table* spec = jhtml->spec;
1914 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<img", NULL);
1917 /*--------------------------------------------------------------------------*/
1918 /* Get Attributes */
1919 /*--------------------------------------------------------------------------*/
1920 for (attr = qs_get_attr(doc,node);
1922 attr = qs_get_next_attr(doc,attr)) {
1923 char* name = qs_get_attr_name(doc,attr);
1924 char* value = qs_get_attr_value(doc,attr);
1926 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
1927 /*----------------------------------------------------------------------*/
1929 /*----------------------------------------------------------------------*/
1930 #ifdef IMG_NOT_CONVERT_FILENAME
1931 value = chxj_encoding_parameter(r, value);
1932 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1933 jhtml->out = apr_pstrcat(r->pool,
1934 jhtml->out, " src=\"",value,"\"", NULL);
1936 value = chxj_img_conv(r, spec, value);
1937 value = chxj_encoding_parameter(r, value);
1938 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1939 jhtml->out = apr_pstrcat(r->pool,
1940 jhtml->out, " src=\"", value, NULL);
1941 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "\"", NULL);
1945 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
1946 /*----------------------------------------------------------------------*/
1948 /*----------------------------------------------------------------------*/
1949 jhtml->out = apr_pstrcat(r->pool,
1950 jhtml->out, " align=\"",value,"\"", NULL);
1953 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
1954 /*----------------------------------------------------------------------*/
1956 /*----------------------------------------------------------------------*/
1957 jhtml->out = apr_pstrcat(r->pool,
1958 jhtml->out, " width=\"",value,"\"", NULL);
1961 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
1962 /*----------------------------------------------------------------------*/
1964 /*----------------------------------------------------------------------*/
1965 jhtml->out = apr_pstrcat(r->pool,
1966 jhtml->out, " height=\"",value,"\"", NULL);
1969 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
1970 /*----------------------------------------------------------------------*/
1972 /*----------------------------------------------------------------------*/
1973 jhtml->out = apr_pstrcat(r->pool,
1974 jhtml->out, " hspace=\"",value,"\"", NULL);
1977 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
1978 /*----------------------------------------------------------------------*/
1980 /*----------------------------------------------------------------------*/
1981 jhtml->out = apr_pstrcat(r->pool,
1982 jhtml->out, " vspace=\"",value,"\"", NULL);
1985 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
1986 /*----------------------------------------------------------------------*/
1988 /*----------------------------------------------------------------------*/
1989 jhtml->out = apr_pstrcat(r->pool,
1990 jhtml->out, " alt=\"",value,"\"", NULL);
1993 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
1994 /*----------------------------------------------------------------------*/
1996 /*----------------------------------------------------------------------*/
2001 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
2008 * It is a handler who processes the IMG tag.
2010 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2011 * destination is specified.
2012 * @param node [i] The IMG tag node is specified.
2013 * @return The conversion result is returned.
2016 s_jhtml_end_img_tag(void* pdoc, Node* child)
2018 jhtml_t* jhtml = GET_JHTML(pdoc);
2025 * It is a handler who processes the SELECT tag.
2027 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2028 * destination is specified.
2029 * @param node [i] The SELECT tag node is specified.
2030 * @return The conversion result is returned.
2033 s_jhtml_start_select_tag(void* pdoc, Node* child)
2035 jhtml_t* jhtml = GET_JHTML(pdoc);
2036 Doc* doc = jhtml->doc;
2037 request_rec* r = doc->r;
2043 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<select", NULL);
2044 for (attr = qs_get_attr(doc,child);
2046 attr = qs_get_next_attr(doc,attr)) {
2047 char* nm = qs_get_attr_name(doc,attr);
2048 char* val = qs_get_attr_value(doc,attr);
2050 if ((*name == 's' || *name == 'S') && strcasecmp(nm, "size") == 0) {
2051 /*----------------------------------------------------------------------*/
2052 /* CHTML 1.0 version 2.0 */
2053 /*----------------------------------------------------------------------*/
2054 size = apr_pstrdup(r->pool, val);
2057 if ((*name == 'n' || *name == 'N') && strcasecmp(nm, "name") == 0) {
2058 /*----------------------------------------------------------------------*/
2059 /* CHTML 1.0 version 2.0 */
2060 /*----------------------------------------------------------------------*/
2061 name = apr_pstrdup(r->pool, val);
2064 if ((*name == 'm' || *name == 'M') && strcasecmp(nm, "multiple") == 0) {
2065 /*----------------------------------------------------------------------*/
2066 /* CHTML 1.0 version 2.0 */
2067 /*----------------------------------------------------------------------*/
2073 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " size=\"",size,"\"", NULL);
2076 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",name,"\"", NULL);
2078 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\n", NULL);
2084 * It is a handler who processes the SELECT tag.
2086 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2087 * destination is specified.
2088 * @param node [i] The SELECT tag node is specified.
2089 * @return The conversion result is returned.
2092 s_jhtml_end_select_tag(void* pdoc, Node* child)
2094 jhtml_t* jhtml = GET_JHTML(pdoc);
2095 Doc* doc = jhtml->doc;
2096 request_rec* r = doc->r;
2098 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</select>\n", NULL);
2104 * It is a handler who processes the OPTION tag.
2106 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2107 * destination is specified.
2108 * @param node [i] The OPTION tag node is specified.
2109 * @return The conversion result is returned.
2112 s_jhtml_start_option_tag(void* pdoc, Node* child)
2114 jhtml_t* jhtml = GET_JHTML(pdoc);
2115 Doc* doc = jhtml->doc;
2116 request_rec* r = doc->r;
2119 char* selected = NULL;
2122 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<option", NULL);
2123 for (attr = qs_get_attr(doc,child);
2125 attr = qs_get_next_attr(doc,attr)) {
2126 char* nm = qs_get_attr_name(doc,attr);
2127 char* val = qs_get_attr_value(doc,attr);
2129 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "selected") == 0) {
2130 /*----------------------------------------------------------------------*/
2131 /* CHTML 1.0 version 2.0 */
2132 /*----------------------------------------------------------------------*/
2133 selected = apr_pstrdup(r->pool, val);
2136 if ((*nm == 'v' || *nm == 'V') && strcasecmp(nm, "value") == 0) {
2137 /*----------------------------------------------------------------------*/
2138 /* CHTML 1.0 version 2.0 */
2139 /*----------------------------------------------------------------------*/
2140 value = apr_pstrdup(r->pool, val);
2145 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"",value,"\"", NULL);
2147 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"\"", NULL);
2150 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " selected ", NULL);
2152 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
2159 * It is a handler who processes the OPTION tag.
2161 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2162 * destination is specified.
2163 * @param node [i] The OPTION tag node is specified.
2164 * @return The conversion result is returned.
2167 s_jhtml_end_option_tag(void* pdoc, Node* child)
2169 jhtml_t* jhtml = GET_JHTML(pdoc);
2178 * It is a handler who processes the DIV tag.
2180 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2181 * destination is specified.
2182 * @param node [i] The DIV tag node is specified.
2183 * @return The conversion result is returned.
2186 s_jhtml_start_div_tag(void* pdoc, Node* child)
2188 jhtml_t* jhtml = GET_JHTML(pdoc);
2189 Doc* doc = jhtml->doc;
2190 request_rec* r = doc->r;
2195 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<div", NULL);
2196 for (attr = qs_get_attr(doc,child);
2198 attr = qs_get_next_attr(doc,attr)) {
2199 char* nm = qs_get_attr_name(doc,attr);
2200 char* val = qs_get_attr_value(doc,attr);
2202 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2203 /*----------------------------------------------------------------------*/
2204 /* CHTML 1.0 (W3C version 3.2) */
2205 /*----------------------------------------------------------------------*/
2206 align = apr_pstrdup(r->pool, val);
2211 jhtml->out = apr_pstrcat(r->pool,
2212 jhtml->out, " align=\"", align, "\"", NULL);
2214 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
2221 * It is a handler who processes the DIV tag.
2223 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2224 * destination is specified.
2225 * @param node [i] The DIV tag node is specified.
2226 * @return The conversion result is returned.
2229 s_jhtml_end_div_tag(void* pdoc, Node* child)
2231 jhtml_t* jhtml = GET_JHTML(pdoc);
2232 Doc* doc = jhtml->doc;
2233 request_rec* r = doc->r;
2235 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</div>\n", NULL);
2242 chxj_istyle_to_mode(request_rec* r, const char* s)
2248 case '1': return apr_psprintf(r->pool, "hiragana");
2249 case '2': return apr_psprintf(r->pool, "hankakukana");
2250 case '3': return apr_psprintf(r->pool, "alphabet");
2251 case '4': return apr_psprintf(r->pool, "numeric");
2253 tmp = apr_palloc(r->pool, 1);
2255 return apr_pstrdup(r->pool, tmp);
2259 tmp = apr_palloc(r->pool, 1);
2261 return apr_pstrdup(r->pool,tmp);
2266 s_jhtml_chxjif_tag(void* pdoc, Node* node)
2268 jhtml_t* jhtml = GET_JHTML(pdoc);
2269 Doc* doc = jhtml->doc;
2271 request_rec* r = doc->r;
2273 for (child = qs_get_child_node(doc, node);
2275 child = qs_get_next_node(doc, child)) {
2276 jhtml->out = apr_pstrcat(r->pool, jhtml->out, child->otext, NULL);
2277 s_jhtml_chxjif_tag(jhtml, child);
2284 * It is a handler who processes the TEXTARE tag.
2286 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2287 * destination is specified.
2288 * @param node [i] The TEXTAREA tag node is specified.
2289 * @return The conversion result is returned.
2292 s_jhtml_start_textarea_tag(void* pdoc, Node* node)
2294 jhtml_t* jhtml = GET_JHTML(pdoc);
2295 Doc* doc = jhtml->doc;
2296 request_rec* r = doc->r;
2299 jhtml->textarea_flag++;
2300 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<textarea ", NULL);
2302 for (attr = qs_get_attr(doc,node);
2304 attr = qs_get_next_attr(doc,attr)) {
2306 char* name = qs_get_attr_name(doc,attr);
2307 char* value = qs_get_attr_value(doc,attr);
2309 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2310 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",value,"\"", NULL);
2313 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2314 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " rows=\"",value,"\"", NULL);
2317 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2318 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " cols=\"",value,"\"", NULL);
2322 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\r\n", NULL);
2329 * It is a handler who processes the TEXTAREA tag.
2331 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2332 * destination is specified.
2333 * @param node [i] The TEXTAREA tag node is specified.
2334 * @return The conversion result is returned.
2337 s_jhtml_end_textarea_tag(void* pdoc, Node* child)
2339 jhtml_t* jhtml = GET_JHTML(pdoc);
2340 Doc* doc = jhtml->doc;
2341 request_rec* r = doc->r;
2343 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</textarea>\r\n", NULL);
2344 jhtml->textarea_flag--;
2350 * It is a handler who processes the B tag.
2352 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2353 * destination is specified.
2354 * @param node [i] The B tag node is specified.
2355 * @return The conversion result is returned.
2358 s_jhtml_start_b_tag(void* pdoc, Node* node)
2360 jhtml_t* jhtml = GET_JHTML(pdoc);
2361 Doc* doc = jhtml->doc;
2362 request_rec* r = doc->r;
2364 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<b>", NULL);
2371 * It is a handler who processes the B tag.
2373 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2374 * destination is specified.
2375 * @param node [i] The B tag node is specified.
2376 * @return The conversion result is returned.
2379 s_jhtml_end_b_tag(void* pdoc, Node* child)
2381 jhtml_t* jhtml = GET_JHTML(pdoc);
2382 Doc* doc = jhtml->doc;
2383 request_rec* r = doc->r;
2385 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</b>\r\n", NULL);
2391 s_jhtml_text_tag(void* pdoc, Node* child)
2393 jhtml_t* jhtml = GET_JHTML(pdoc);
2394 Doc* doc = jhtml->doc;
2401 request_rec* r = doc->r;
2403 textval = qs_get_node_value(doc,child);
2404 textval = qs_trim_string(jhtml->doc->r, textval);
2405 if (strlen(textval) == 0)
2408 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2409 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2411 tdst = qs_alloc_zero_byte_string(r);
2412 memset(one_byte, 0, sizeof(one_byte));
2415 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2417 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
2419 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2424 if (is_sjis_kanji(textval[ii])) {
2425 one_byte[0] = textval[ii+0];
2426 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2427 one_byte[0] = textval[ii+1];
2428 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2432 if (jhtml->pre_flag) {
2433 one_byte[0] = textval[ii+0];
2434 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2437 if (jhtml->textarea_flag) {
2438 one_byte[0] = textval[ii+0];
2439 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2442 if (textval[ii] != '\r' && textval[ii] != '\n') {
2443 one_byte[0] = textval[ii+0];
2444 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2448 jhtml->out = apr_pstrcat(r->pool, jhtml->out, tdst, NULL);