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)
1304 jhtml = GET_JHTML(pdoc);
1307 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</font>", NULL);
1314 * It is a handler who processes the FORM tag.
1316 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1317 * destination is specified.
1318 * @param node [i] The FORM tag node is specified.
1319 * @return The conversion result is returned.
1322 s_jhtml_start_form_tag(void* pdoc, Node* node)
1329 jhtml = GET_JHTML(pdoc);
1333 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<form", NULL);
1335 /*--------------------------------------------------------------------------*/
1336 /* Get Attributes */
1337 /*--------------------------------------------------------------------------*/
1338 for (attr = qs_get_attr(doc,node);
1340 attr = qs_get_next_attr(doc,attr)) {
1345 name = qs_get_attr_name(doc,attr);
1346 value = qs_get_attr_value(doc,attr);
1348 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1349 /*----------------------------------------------------------------------*/
1351 /*----------------------------------------------------------------------*/
1352 jhtml->out = apr_pstrcat(r->pool,
1360 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "method") == 0) {
1361 /*----------------------------------------------------------------------*/
1363 /*----------------------------------------------------------------------*/
1364 jhtml->out = apr_pstrcat(r->pool,
1372 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1373 /*----------------------------------------------------------------------*/
1375 /* It is special only for CHTML. */
1376 /*----------------------------------------------------------------------*/
1377 jhtml->out = apr_pstrcat(r->pool,
1384 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1386 if (jhtml->cookie && jhtml->cookie->cookie_id) {
1387 jhtml->out = apr_psprintf(r->pool, "%s<input type='hidden' name='%s' value='%s'>",
1390 jhtml->cookie->cookie_id);
1398 * It is a handler who processes the FORM tag.
1400 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1401 * destination is specified.
1402 * @param node [i] The FORM tag node is specified.
1403 * @return The conversion result is returned.
1406 s_jhtml_end_form_tag(void* pdoc, Node* child)
1408 jhtml_t* jhtml = GET_JHTML(pdoc);
1409 Doc* doc = jhtml->doc;
1410 request_rec* r = doc->r;
1412 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</form>", NULL);
1419 * It is a handler who processes the INPUT tag.
1421 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1422 * destination is specified.
1423 * @param node [i] The INPUT tag node is specified.
1424 * @return The conversion result is returned.
1427 s_jhtml_start_input_tag(void* pdoc, Node* node)
1441 jhtml = GET_JHTML(pdoc);
1453 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<input", NULL);
1455 /*--------------------------------------------------------------------------*/
1456 /* Get Attributes */
1457 /*--------------------------------------------------------------------------*/
1459 type = qs_get_type_attr(doc, node, r);
1460 name = qs_get_name_attr(doc, node, r);
1461 value = qs_get_value_attr(doc,node,r);
1462 istyle = qs_get_istyle_attr(doc,node,r);
1463 max_length = qs_get_maxlength_attr(doc,node,r);
1464 checked = qs_get_checked_attr(doc,node,r);
1465 accesskey = qs_get_accesskey_attr(doc, node, r);
1466 size = qs_get_size_attr(doc, node, r);
1469 jhtml->out = apr_pstrcat(r->pool,
1477 jhtml->out = apr_pstrcat(r->pool,
1485 jhtml->out = apr_pstrcat(r->pool,
1493 jhtml->out = apr_pstrcat(r->pool,
1501 jhtml->out = apr_pstrcat(r->pool,
1508 /*------------------------------------------------------------------------*/
1510 /*------------------------------------------------------------------------*/
1511 if (type && (*type == 'p' || *type == 'P') && strcasecmp(type, "password") == 0
1512 && ! jhtml->entryp->pc_flag ) {
1513 jhtml->out = apr_pstrcat(r->pool,
1521 jhtml->out = apr_pstrcat(r->pool,
1524 chxj_istyle_to_mode(r,istyle),
1530 if (istyle == NULL && type != NULL && strcasecmp(type, "password") == 0) {
1531 jhtml->out = apr_pstrcat(r->pool,
1538 /*--------------------------------------------------------------------------*/
1539 /* The figure is default for the password. */
1540 /*--------------------------------------------------------------------------*/
1542 jhtml->out = apr_pstrcat(r->pool,
1551 jhtml->out = apr_pstrcat(r->pool,
1557 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
1564 * It is a handler who processes the INPUT tag.
1566 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1567 * destination is specified.
1568 * @param node [i] The INPUT tag node is specified.
1569 * @return The conversion result is returned.
1572 s_jhtml_end_input_tag(void* pdoc, Node* child)
1574 jhtml_t* jhtml = GET_JHTML(pdoc);
1581 * It is a handler who processes the CENTER tag.
1583 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1584 * destination is specified.
1585 * @param node [i] The CENTER tag node is specified.
1586 * @return The conversion result is returned.
1589 s_jhtml_start_center_tag(void* pdoc, Node* node)
1591 jhtml_t* jhtml = GET_JHTML(pdoc);
1592 Doc* doc = jhtml->doc;
1593 request_rec* r = doc->r;
1595 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<center>", NULL);
1602 * It is a handler who processes the CENTER tag.
1604 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1605 * destination is specified.
1606 * @param node [i] The CENTER tag node is specified.
1607 * @return The conversion result is returned.
1610 s_jhtml_end_center_tag(void* pdoc, Node* child)
1616 jhtml = GET_JHTML(pdoc);
1620 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</center>", NULL);
1627 * It is a handler who processes the li tag.
1629 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1630 * destination is specified.
1631 * @param node [i] The li tag node is specified.
1632 * @return The conversion result is returned.
1635 s_jhtml_start_li_tag(void* pdoc, Node* node)
1641 jhtml = GET_JHTML(pdoc);
1645 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<li>", NULL);
1652 * It is a handler who processes the li tag.
1654 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1655 * destination is specified.
1656 * @param node [i] The li tag node is specified.
1657 * @return The conversion result is returned.
1660 s_jhtml_end_li_tag(void* pdoc, Node* child)
1666 jhtml = GET_JHTML(pdoc);
1670 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</li>", NULL);
1677 * It is a handler who processes the OL tag.
1679 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1680 * destination is specified.
1681 * @param node [i] The OL tag node is specified.
1682 * @return The conversion result is returned.
1685 s_jhtml_start_ol_tag(void* pdoc, Node* node)
1691 jhtml = GET_JHTML(pdoc);
1695 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ol>", NULL);
1702 * It is a handler who processes the OL tag.
1704 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1705 * destination is specified.
1706 * @param node [i] The OL tag node is specified.
1707 * @return The conversion result is returned.
1710 s_jhtml_end_ol_tag(void* pdoc, Node* child)
1716 jhtml = GET_JHTML(pdoc);
1720 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ol>", NULL);
1727 * It is a handler who processes the P tag.
1729 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1730 * destination is specified.
1731 * @param node [i] The P tag node is specified.
1732 * @return The conversion result is returned.
1735 s_jhtml_start_p_tag(void* pdoc, Node* node)
1741 jhtml = GET_JHTML(pdoc);
1745 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<p>", NULL);
1752 * It is a handler who processes the P tag.
1754 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1755 * destination is specified.
1756 * @param node [i] The P tag node is specified.
1757 * @return The conversion result is returned.
1760 s_jhtml_end_p_tag(void* pdoc, Node* child)
1762 jhtml_t* jhtml = GET_JHTML(pdoc);
1763 Doc* doc = jhtml->doc;
1764 request_rec* r = doc->r;
1766 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</p>", NULL);
1773 * It is a handler who processes the PRE tag.
1775 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1776 * destination is specified.
1777 * @param node [i] The PRE tag node is specified.
1778 * @return The conversion result is returned.
1781 s_jhtml_start_pre_tag(void* pdoc, Node* node)
1783 jhtml_t* jhtml = GET_JHTML(pdoc);
1784 Doc* doc = jhtml->doc;
1785 request_rec* r = doc->r;
1788 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<pre>", NULL);
1795 * It is a handler who processes the PRE tag.
1797 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1798 * destination is specified.
1799 * @param node [i] The PRE tag node is specified.
1800 * @return The conversion result is returned.
1803 s_jhtml_end_pre_tag(void* pdoc, Node* child)
1805 jhtml_t* jhtml = GET_JHTML(pdoc);
1806 Doc* doc = jhtml->doc;
1807 request_rec* r = doc->r;
1809 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</pre>", NULL);
1817 * It is a handler who processes the UL tag.
1819 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1820 * destination is specified.
1821 * @param node [i] The UL tag node is specified.
1822 * @return The conversion result is returned.
1825 s_jhtml_start_ul_tag(void* pdoc, Node* node)
1827 jhtml_t* jhtml = GET_JHTML(pdoc);
1828 Doc* doc = jhtml->doc;
1829 request_rec* r = doc->r;
1831 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ul>", NULL);
1838 * It is a handler who processes the UL tag.
1840 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1841 * destination is specified.
1842 * @param node [i] The UL tag node is specified.
1843 * @return The conversion result is returned.
1846 s_jhtml_end_ul_tag(void* pdoc, Node* child)
1848 jhtml_t* jhtml = GET_JHTML(pdoc);
1849 Doc* doc = jhtml->doc;
1850 request_rec* r = doc->r;
1852 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ul>", NULL);
1859 * It is a handler who processes the HR tag.
1861 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1862 * destination is specified.
1863 * @param node [i] The HR tag node is specified.
1864 * @return The conversion result is returned.
1867 s_jhtml_start_hr_tag(void* pdoc, Node* node)
1869 jhtml_t* jhtml = GET_JHTML(pdoc);
1870 Doc* doc = jhtml->doc;
1871 request_rec* r = doc->r;
1874 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<hr ", NULL);
1876 for (attr = qs_get_attr(doc,node);
1878 attr = qs_get_next_attr(doc,attr)) {
1879 char* name = qs_get_attr_name(doc,attr);
1880 char* value = qs_get_attr_value(doc,attr);
1881 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
1882 /*----------------------------------------------------------------------*/
1884 /*----------------------------------------------------------------------*/
1885 jhtml->out = apr_pstrcat(r->pool,
1887 " align=\"", value, "\" ", NULL);
1890 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1891 /*----------------------------------------------------------------------*/
1893 /*----------------------------------------------------------------------*/
1894 jhtml->out = apr_pstrcat(r->pool,
1896 " size=\"", value, "\" ", NULL);
1899 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width") == 0) {
1900 /*----------------------------------------------------------------------*/
1902 /*----------------------------------------------------------------------*/
1903 jhtml->out = apr_pstrcat(r->pool,
1905 " width=\"", value, "\" ", NULL);
1908 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "noshade") == 0) {
1909 /*----------------------------------------------------------------------*/
1911 /*----------------------------------------------------------------------*/
1912 jhtml->out = apr_pstrcat(r->pool,
1917 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1918 /*----------------------------------------------------------------------*/
1920 /*----------------------------------------------------------------------*/
1924 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
1931 * It is a handler who processes the HR tag.
1933 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1934 * destination is specified.
1935 * @param node [i] The HR tag node is specified.
1936 * @return The conversion result is returned.
1939 s_jhtml_end_hr_tag(void* pdoc, Node* child)
1941 jhtml_t* jhtml = GET_JHTML(pdoc);
1948 * It is a handler who processes the IMG tag.
1950 * @param pdoc [i/o] The pointer to the CHTML structure at the output
1951 * destination is specified.
1952 * @param node [i] The IMG tag node is specified.
1953 * @return The conversion result is returned.
1956 s_jhtml_start_img_tag(void* pdoc, Node* node)
1958 jhtml_t* jhtml = GET_JHTML(pdoc);
1959 Doc* doc = jhtml->doc;
1960 request_rec* r = doc->r;
1962 #ifndef IMG_NOT_CONVERT_FILENAME
1963 device_table* spec = jhtml->spec;
1966 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<img", NULL);
1969 /*--------------------------------------------------------------------------*/
1970 /* Get Attributes */
1971 /*--------------------------------------------------------------------------*/
1972 for (attr = qs_get_attr(doc,node);
1974 attr = qs_get_next_attr(doc,attr)) {
1975 char* name = qs_get_attr_name(doc,attr);
1976 char* value = qs_get_attr_value(doc,attr);
1978 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
1979 /*----------------------------------------------------------------------*/
1981 /*----------------------------------------------------------------------*/
1982 #ifdef IMG_NOT_CONVERT_FILENAME
1983 value = chxj_encoding_parameter(r, value);
1984 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1985 jhtml->out = apr_pstrcat(r->pool,
1986 jhtml->out, " src=\"",value,"\"", NULL);
1988 value = chxj_img_conv(r, spec, value);
1989 value = chxj_encoding_parameter(r, value);
1990 value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
1991 jhtml->out = apr_pstrcat(r->pool,
1992 jhtml->out, " src=\"", value, NULL);
1993 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "\"", NULL);
1997 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
1998 /*----------------------------------------------------------------------*/
2000 /*----------------------------------------------------------------------*/
2001 jhtml->out = apr_pstrcat(r->pool,
2002 jhtml->out, " align=\"",value,"\"", NULL);
2005 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2006 /*----------------------------------------------------------------------*/
2008 /*----------------------------------------------------------------------*/
2009 jhtml->out = apr_pstrcat(r->pool,
2010 jhtml->out, " width=\"",value,"\"", NULL);
2013 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
2014 /*----------------------------------------------------------------------*/
2016 /*----------------------------------------------------------------------*/
2017 jhtml->out = apr_pstrcat(r->pool,
2018 jhtml->out, " height=\"",value,"\"", NULL);
2021 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
2022 /*----------------------------------------------------------------------*/
2024 /*----------------------------------------------------------------------*/
2025 jhtml->out = apr_pstrcat(r->pool,
2026 jhtml->out, " hspace=\"",value,"\"", NULL);
2029 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2030 /*----------------------------------------------------------------------*/
2032 /*----------------------------------------------------------------------*/
2033 jhtml->out = apr_pstrcat(r->pool,
2034 jhtml->out, " vspace=\"",value,"\"", NULL);
2037 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
2038 /*----------------------------------------------------------------------*/
2040 /*----------------------------------------------------------------------*/
2041 jhtml->out = apr_pstrcat(r->pool,
2042 jhtml->out, " alt=\"",value,"\"", NULL);
2045 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
2046 /*----------------------------------------------------------------------*/
2048 /*----------------------------------------------------------------------*/
2053 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
2060 * It is a handler who processes the IMG tag.
2062 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2063 * destination is specified.
2064 * @param node [i] The IMG tag node is specified.
2065 * @return The conversion result is returned.
2068 s_jhtml_end_img_tag(void* pdoc, Node* child)
2070 jhtml_t* jhtml = GET_JHTML(pdoc);
2077 * It is a handler who processes the SELECT tag.
2079 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2080 * destination is specified.
2081 * @param node [i] The SELECT tag node is specified.
2082 * @return The conversion result is returned.
2085 s_jhtml_start_select_tag(void* pdoc, Node* child)
2087 jhtml_t* jhtml = GET_JHTML(pdoc);
2088 Doc* doc = jhtml->doc;
2089 request_rec* r = doc->r;
2095 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<select", NULL);
2096 for (attr = qs_get_attr(doc,child);
2098 attr = qs_get_next_attr(doc,attr)) {
2099 char* nm = qs_get_attr_name(doc,attr);
2100 char* val = qs_get_attr_value(doc,attr);
2102 if ((*name == 's' || *name == 'S') && strcasecmp(nm, "size") == 0) {
2103 /*----------------------------------------------------------------------*/
2104 /* CHTML 1.0 version 2.0 */
2105 /*----------------------------------------------------------------------*/
2106 size = apr_pstrdup(r->pool, val);
2109 if ((*name == 'n' || *name == 'N') && strcasecmp(nm, "name") == 0) {
2110 /*----------------------------------------------------------------------*/
2111 /* CHTML 1.0 version 2.0 */
2112 /*----------------------------------------------------------------------*/
2113 name = apr_pstrdup(r->pool, val);
2116 if ((*name == 'm' || *name == 'M') && strcasecmp(nm, "multiple") == 0) {
2117 /*----------------------------------------------------------------------*/
2118 /* CHTML 1.0 version 2.0 */
2119 /*----------------------------------------------------------------------*/
2125 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " size=\"",size,"\"", NULL);
2128 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",name,"\"", NULL);
2130 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\n", NULL);
2136 * It is a handler who processes the SELECT tag.
2138 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2139 * destination is specified.
2140 * @param node [i] The SELECT tag node is specified.
2141 * @return The conversion result is returned.
2144 s_jhtml_end_select_tag(void* pdoc, Node* child)
2146 jhtml_t* jhtml = GET_JHTML(pdoc);
2147 Doc* doc = jhtml->doc;
2148 request_rec* r = doc->r;
2150 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</select>\n", NULL);
2156 * It is a handler who processes the OPTION tag.
2158 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2159 * destination is specified.
2160 * @param node [i] The OPTION tag node is specified.
2161 * @return The conversion result is returned.
2164 s_jhtml_start_option_tag(void* pdoc, Node* child)
2166 jhtml_t* jhtml = GET_JHTML(pdoc);
2167 Doc* doc = jhtml->doc;
2168 request_rec* r = doc->r;
2171 char* selected = NULL;
2174 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<option", NULL);
2175 for (attr = qs_get_attr(doc,child);
2177 attr = qs_get_next_attr(doc,attr)) {
2178 char* nm = qs_get_attr_name(doc,attr);
2179 char* val = qs_get_attr_value(doc,attr);
2181 if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "selected") == 0) {
2182 /*----------------------------------------------------------------------*/
2183 /* CHTML 1.0 version 2.0 */
2184 /*----------------------------------------------------------------------*/
2185 selected = apr_pstrdup(r->pool, val);
2188 if ((*nm == 'v' || *nm == 'V') && strcasecmp(nm, "value") == 0) {
2189 /*----------------------------------------------------------------------*/
2190 /* CHTML 1.0 version 2.0 */
2191 /*----------------------------------------------------------------------*/
2192 value = apr_pstrdup(r->pool, val);
2197 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"",value,"\"", NULL);
2199 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"\"", NULL);
2202 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " selected ", NULL);
2204 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
2211 * It is a handler who processes the OPTION tag.
2213 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2214 * destination is specified.
2215 * @param node [i] The OPTION tag node is specified.
2216 * @return The conversion result is returned.
2219 s_jhtml_end_option_tag(void* pdoc, Node* child)
2221 jhtml_t* jhtml = GET_JHTML(pdoc);
2230 * It is a handler who processes the DIV tag.
2232 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2233 * destination is specified.
2234 * @param node [i] The DIV tag node is specified.
2235 * @return The conversion result is returned.
2238 s_jhtml_start_div_tag(void* pdoc, Node* child)
2240 jhtml_t* jhtml = GET_JHTML(pdoc);
2241 Doc* doc = jhtml->doc;
2242 request_rec* r = doc->r;
2247 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<div", NULL);
2248 for (attr = qs_get_attr(doc,child);
2250 attr = qs_get_next_attr(doc,attr)) {
2251 char* nm = qs_get_attr_name(doc,attr);
2252 char* val = qs_get_attr_value(doc,attr);
2254 if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
2255 /*----------------------------------------------------------------------*/
2256 /* CHTML 1.0 (W3C version 3.2) */
2257 /*----------------------------------------------------------------------*/
2258 align = apr_pstrdup(r->pool, val);
2263 jhtml->out = apr_pstrcat(r->pool,
2264 jhtml->out, " align=\"", align, "\"", NULL);
2266 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
2273 * It is a handler who processes the DIV tag.
2275 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2276 * destination is specified.
2277 * @param node [i] The DIV tag node is specified.
2278 * @return The conversion result is returned.
2281 s_jhtml_end_div_tag(void* pdoc, Node* child)
2283 jhtml_t* jhtml = GET_JHTML(pdoc);
2284 Doc* doc = jhtml->doc;
2285 request_rec* r = doc->r;
2287 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</div>\n", NULL);
2294 chxj_istyle_to_mode(request_rec* r, const char* s)
2300 case '1': return apr_psprintf(r->pool, "hiragana");
2301 case '2': return apr_psprintf(r->pool, "hankakukana");
2302 case '3': return apr_psprintf(r->pool, "alphabet");
2303 case '4': return apr_psprintf(r->pool, "numeric");
2305 tmp = apr_palloc(r->pool, 1);
2307 return apr_pstrdup(r->pool, tmp);
2311 tmp = apr_palloc(r->pool, 1);
2313 return apr_pstrdup(r->pool,tmp);
2318 s_jhtml_chxjif_tag(void* pdoc, Node* node)
2320 jhtml_t* jhtml = GET_JHTML(pdoc);
2321 Doc* doc = jhtml->doc;
2323 request_rec* r = doc->r;
2325 for (child = qs_get_child_node(doc, node);
2327 child = qs_get_next_node(doc, child)) {
2328 jhtml->out = apr_pstrcat(r->pool, jhtml->out, child->otext, NULL);
2329 s_jhtml_chxjif_tag(jhtml, child);
2336 * It is a handler who processes the TEXTARE tag.
2338 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2339 * destination is specified.
2340 * @param node [i] The TEXTAREA tag node is specified.
2341 * @return The conversion result is returned.
2344 s_jhtml_start_textarea_tag(void* pdoc, Node* node)
2346 jhtml_t* jhtml = GET_JHTML(pdoc);
2347 Doc* doc = jhtml->doc;
2348 request_rec* r = doc->r;
2351 jhtml->textarea_flag++;
2352 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<textarea ", NULL);
2354 for (attr = qs_get_attr(doc,node);
2356 attr = qs_get_next_attr(doc,attr)) {
2358 char* name = qs_get_attr_name(doc,attr);
2359 char* value = qs_get_attr_value(doc,attr);
2361 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2362 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",value,"\"", NULL);
2365 if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
2366 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " rows=\"",value,"\"", NULL);
2369 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
2370 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " cols=\"",value,"\"", NULL);
2374 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\r\n", NULL);
2381 * It is a handler who processes the TEXTAREA tag.
2383 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2384 * destination is specified.
2385 * @param node [i] The TEXTAREA tag node is specified.
2386 * @return The conversion result is returned.
2389 s_jhtml_end_textarea_tag(void* pdoc, Node* child)
2391 jhtml_t* jhtml = GET_JHTML(pdoc);
2392 Doc* doc = jhtml->doc;
2393 request_rec* r = doc->r;
2395 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</textarea>\r\n", NULL);
2396 jhtml->textarea_flag--;
2402 * It is a handler who processes the B tag.
2404 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2405 * destination is specified.
2406 * @param node [i] The B tag node is specified.
2407 * @return The conversion result is returned.
2410 s_jhtml_start_b_tag(void* pdoc, Node* node)
2412 jhtml_t* jhtml = GET_JHTML(pdoc);
2413 Doc* doc = jhtml->doc;
2414 request_rec* r = doc->r;
2416 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<b>", NULL);
2423 * It is a handler who processes the B tag.
2425 * @param pdoc [i/o] The pointer to the CHTML structure at the output
2426 * destination is specified.
2427 * @param node [i] The B tag node is specified.
2428 * @return The conversion result is returned.
2431 s_jhtml_end_b_tag(void* pdoc, Node* child)
2433 jhtml_t* jhtml = GET_JHTML(pdoc);
2434 Doc* doc = jhtml->doc;
2435 request_rec* r = doc->r;
2437 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</b>\r\n", NULL);
2443 s_jhtml_text_tag(void* pdoc, Node* child)
2445 jhtml_t* jhtml = GET_JHTML(pdoc);
2446 Doc* doc = jhtml->doc;
2453 request_rec* r = doc->r;
2455 textval = qs_get_node_value(doc,child);
2456 textval = qs_trim_string(jhtml->doc->r, textval);
2457 if (strlen(textval) == 0)
2460 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2461 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2463 tdst = qs_alloc_zero_byte_string(r);
2464 memset(one_byte, 0, sizeof(one_byte));
2467 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2469 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
2471 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2476 if (is_sjis_kanji(textval[ii])) {
2477 one_byte[0] = textval[ii+0];
2478 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2479 one_byte[0] = textval[ii+1];
2480 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2484 if (jhtml->pre_flag) {
2485 one_byte[0] = textval[ii+0];
2486 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2489 if (jhtml->textarea_flag) {
2490 one_byte[0] = textval[ii+0];
2491 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2494 if (textval[ii] != '\r' && textval[ii] != '\n') {
2495 one_byte[0] = textval[ii+0];
2496 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2500 jhtml->out = apr_pstrcat(r->pool, jhtml->out, tdst, NULL);