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"
23 static char* s_jhtml_node_exchange (jhtml_t* jhtml, Node* node, int indent);
24 static char* s_jhtml_start_html_tag (jhtml_t* jhtml, Node* child);
25 static char* s_jhtml_end_html_tag (jhtml_t* jhtml, Node* child);
26 static char* s_jhtml_start_meta_tag (jhtml_t* jhtml, Node* node);
27 static char* s_jhtml_end_meta_tag (jhtml_t* jhtml, Node* node);
28 static char* s_jhtml_start_head_tag (jhtml_t* jhtml, Node* node);
29 static char* s_jhtml_end_head_tag (jhtml_t* jhtml, Node* node);
30 static char* s_jhtml_start_title_tag (jhtml_t* jhtml, Node* node);
31 static char* s_jhtml_end_title_tag (jhtml_t* jhtml, Node* node);
32 static char* s_jhtml_start_base_tag (jhtml_t* jhtml, Node* node);
33 static char* s_jhtml_end_base_tag (jhtml_t* jhtml, Node* node);
34 static char* s_jhtml_start_body_tag (jhtml_t* jhtml, Node* node);
35 static char* s_jhtml_end_body_tag (jhtml_t* jhtml, Node* node);
36 static char* s_jhtml_start_a_tag (jhtml_t* jhtml, Node* node);
37 static char* s_jhtml_end_a_tag (jhtml_t* jhtml, Node* node);
38 static char* s_jhtml_start_ul_tag (jhtml_t* jhtml, Node* node);
39 static char* s_jhtml_end_ul_tag (jhtml_t* jhtml, Node* node);
40 static char* s_jhtml_start_ol_tag (jhtml_t* jhtml, Node* node);
41 static char* s_jhtml_end_ol_tag (jhtml_t* jhtml, Node* node);
42 static char* s_jhtml_start_li_tag (jhtml_t* jhtml, Node* node);
43 static char* s_jhtml_end_li_tag (jhtml_t* jhtml, Node* node);
44 static char* s_jhtml_start_br_tag (jhtml_t* jhtml, Node* node);
45 static char* s_jhtml_end_br_tag (jhtml_t* jhtml, Node* node);
46 static char* s_jhtml_start_tr_tag (jhtml_t* jhtml, Node* node);
47 static char* s_jhtml_end_tr_tag (jhtml_t* jhtml, Node* node);
48 static char* s_jhtml_start_font_tag (jhtml_t* jhtml, Node* node);
49 static char* s_jhtml_end_font_tag (jhtml_t* jhtml, Node* node);
50 static char* s_jhtml_start_form_tag (jhtml_t* jhtml, Node* node);
51 static char* s_jhtml_end_form_tag (jhtml_t* jhtml, Node* node);
52 static char* s_jhtml_start_input_tag (jhtml_t* jhtml, Node* node);
53 static char* s_jhtml_end_input_tag (jhtml_t* jhtml, Node* node);
54 static char* s_jhtml_start_center_tag (jhtml_t* jhtml, Node* node);
55 static char* s_jhtml_end_center_tag (jhtml_t* jhtml, Node* node);
56 static char* s_jhtml_start_hr_tag (jhtml_t* jhtml, Node* node);
57 static char* s_jhtml_end_hr_tag (jhtml_t* jhtml, Node* node);
58 static char* s_jhtml_start_img_tag (jhtml_t* jhtml, Node* node);
59 static char* s_jhtml_end_img_tag (jhtml_t* jhtml, Node* node);
60 static char* s_jhtml_start_select_tag (jhtml_t* jhtml, Node* node);
61 static char* s_jhtml_end_select_tag (jhtml_t* jhtml, Node* node);
62 static char* s_jhtml_start_option_tag (jhtml_t* jhtml, Node* node);
63 static char* s_jhtml_end_option_tag (jhtml_t* jhtml, Node* node);
64 static char* s_jhtml_start_div_tag (jhtml_t* jhtml, Node* node);
65 static char* s_jhtml_end_div_tag (jhtml_t* jhtml, Node* node);
66 static void s_init_jhtml(jhtml_t* jhtml, Doc* doc, request_rec* r, device_table_t* spec);
67 static int s_jhtml_search_emoji(jhtml_t* jhtml, char* txt, char** rslt);
68 static char* chxj_istyle_to_mode(request_rec* r, const char* s);
69 static void s_jhtml_chxjif_tag(jhtml_t* jhtml, Node* node);
72 * converts from CHTML5.0 to JHTML.
74 * @param r [i] Requet_rec is appointed.
75 * @param spec [i] The result of the device specification processing which
76 * was done in advance is appointed.
77 * @param src [i] The character string before the converting is appointed.
78 * @return The character string after the converting is returned.
93 /*--------------------------------------------------------------------------*/
95 /*--------------------------------------------------------------------------*/
97 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
99 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,"i found qrcode xml");
102 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,"not found qrcode xml");
104 /*--------------------------------------------------------------------------*/
105 /* The CHTML structure is initialized. */
106 /*--------------------------------------------------------------------------*/
107 s_init_jhtml(&jhtml, &doc, r, spec);
108 ap_set_content_type(r, "text/html; charset=Windows-31J");
110 /*--------------------------------------------------------------------------*/
111 /* The character string of the input is analyzed. */
112 /*--------------------------------------------------------------------------*/
113 qs_init_malloc(&doc);
114 qs_init_root_node(&doc);
116 ss = apr_pcalloc(r->pool, srclen + 1);
117 memset(ss, 0, srclen + 1);
118 memcpy(ss, src, srclen);
120 chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
122 qs_parse_string(&doc,ss,strlen(ss));
124 /*--------------------------------------------------------------------------*/
125 /* It converts it from CHTML to JHTML. */
126 /*--------------------------------------------------------------------------*/
127 dst = s_jhtml_node_exchange(&jhtml, qs_get_root(&doc), 0);
128 qs_all_free(&doc,QX_LOGMARK);
131 return apr_pstrdup(r->pool,ss);
133 if (strlen(dst) == 0)
134 dst = apr_psprintf(r->pool, "\n");
136 *dstlen = strlen(dst);
138 chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
145 * The CHTML structure is initialized.
147 * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
148 * initialized is specified.
149 * @param doc [i] The Doc structure that should be set to the initialized
150 * JHTML structure is specified.
151 * @param r [i] To use POOL, the pointer to request_rec is specified.
152 * @param spec [i] The pointer to the device_table
155 s_init_jhtml(jhtml_t* jhtml, Doc* doc, request_rec* r, device_table_t* spec)
157 memset(doc, 0, sizeof(Doc));
158 memset(jhtml, 0, sizeof(jhtml_t));
163 jhtml->out = qs_alloc_zero_byte_string(r);
164 jhtml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
165 jhtml->doc->parse_mode = PARSE_MODE_CHTML;
169 * It is main processing of conversion from CHTML to JHTML.
171 * @param jhtml [i/o] The pointer to the CHTML structure is specified.
172 * @param node [i] The pointer to a current node is specified.
173 * @param indent [i] The depth of the node processing it now is specified.
175 * @return The character string after it converts it is returned.
178 s_jhtml_node_exchange(jhtml_t* jhtml, Node* node, int indent)
181 Doc* doc = jhtml->doc;
182 request_rec* r = doc->r;
184 /*--------------------------------------------------------------------------*/
185 /* It is the main loop of the conversion processing. */
186 /*--------------------------------------------------------------------------*/
187 for (child = qs_get_child_node(doc,node);
189 child = qs_get_next_node(doc,child)) {
190 char* name = qs_get_node_name(doc,child);
192 /*------------------------------------------------------------------------*/
193 /* <UL> (for TEST) */
194 /*------------------------------------------------------------------------*/
195 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "ul") == 0) {
196 s_jhtml_start_ul_tag (jhtml, child);
197 s_jhtml_node_exchange (jhtml, child, indent+1);
198 s_jhtml_end_ul_tag (jhtml, child);
200 /*------------------------------------------------------------------------*/
201 /* <LI> (for TEST) */
202 /*------------------------------------------------------------------------*/
204 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "li") == 0) {
205 s_jhtml_start_li_tag (jhtml, child);
206 s_jhtml_node_exchange (jhtml, child, indent+1);
207 s_jhtml_end_li_tag (jhtml, child);
209 /*------------------------------------------------------------------------*/
210 /* <OL> (for TEST) */
211 /*------------------------------------------------------------------------*/
213 if ((*name == 'o' || *name == 'O') && strcasecmp(name, "ol") == 0) {
214 s_jhtml_start_ol_tag (jhtml, child);
215 s_jhtml_node_exchange (jhtml, child, indent+1);
216 s_jhtml_end_ol_tag (jhtml, child);
219 if (*name == 'h' || *name == 'H') {
220 /*----------------------------------------------------------------------*/
222 /*----------------------------------------------------------------------*/
223 if (strcasecmp(name, "html") == 0) {
224 s_jhtml_start_html_tag(jhtml, child);
225 s_jhtml_node_exchange (jhtml, child,indent+1);
226 s_jhtml_end_html_tag (jhtml, child);
228 /*----------------------------------------------------------------------*/
230 /*----------------------------------------------------------------------*/
232 if (strcasecmp(name, "head") == 0) {
233 s_jhtml_start_head_tag(jhtml, child);
234 s_jhtml_node_exchange (jhtml, child,indent+1);
235 s_jhtml_end_head_tag (jhtml, child);
237 /*----------------------------------------------------------------------*/
239 /*----------------------------------------------------------------------*/
241 if (strcasecmp(name, "hr") == 0) {
242 s_jhtml_start_hr_tag (jhtml, child);
243 s_jhtml_end_hr_tag (jhtml, child);
246 /*------------------------------------------------------------------------*/
248 /*------------------------------------------------------------------------*/
250 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "meta") == 0) {
251 s_jhtml_start_meta_tag(jhtml, child);
252 s_jhtml_end_meta_tag (jhtml, child);
255 if (*name == 'b' || *name == 'B') {
256 /*----------------------------------------------------------------------*/
258 /*----------------------------------------------------------------------*/
259 if (strcasecmp(name, "base") == 0) {
260 s_jhtml_start_base_tag(jhtml, child);
261 s_jhtml_end_base_tag (jhtml, child);
263 /*----------------------------------------------------------------------*/
265 /*----------------------------------------------------------------------*/
267 if (strcasecmp(name, "body") == 0) {
268 s_jhtml_start_body_tag(jhtml, child);
269 s_jhtml_node_exchange (jhtml, child,indent+1);
270 s_jhtml_end_body_tag (jhtml, child);
272 /*----------------------------------------------------------------------*/
274 /*----------------------------------------------------------------------*/
276 if (strcasecmp(name, "br") == 0) {
277 s_jhtml_start_br_tag (jhtml, child);
278 s_jhtml_node_exchange (jhtml, child,indent+1);
279 s_jhtml_end_br_tag (jhtml, child);
282 /*------------------------------------------------------------------------*/
284 /*------------------------------------------------------------------------*/
286 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "a") == 0) {
287 s_jhtml_start_a_tag (jhtml, child);
288 s_jhtml_node_exchange (jhtml, child,indent+1);
289 s_jhtml_end_a_tag (jhtml, child);
292 if (*name == 'f' || *name == 'F') {
293 /*----------------------------------------------------------------------*/
295 /*----------------------------------------------------------------------*/
296 if (strcasecmp(name, "font") == 0) {
297 s_jhtml_start_font_tag(jhtml, child);
298 s_jhtml_node_exchange (jhtml, child,indent+1);
299 s_jhtml_end_font_tag (jhtml, child);
301 /*----------------------------------------------------------------------*/
303 /*----------------------------------------------------------------------*/
305 if (strcasecmp(name, "form") == 0) {
306 s_jhtml_start_form_tag(jhtml, child);
307 s_jhtml_node_exchange (jhtml, child,indent+1);
308 s_jhtml_end_form_tag (jhtml, child);
312 if (*name == 'i' || *name == 'I') {
313 /*----------------------------------------------------------------------*/
315 /*----------------------------------------------------------------------*/
316 if (strcasecmp(name, "input") == 0) {
317 s_jhtml_start_input_tag (jhtml, child);
318 s_jhtml_node_exchange (jhtml, child,indent+1);
319 s_jhtml_end_input_tag (jhtml, child);
321 /*----------------------------------------------------------------------*/
323 /*----------------------------------------------------------------------*/
325 if (strcasecmp(name, "img") == 0) {
326 s_jhtml_start_img_tag (jhtml, child);
327 s_jhtml_end_img_tag (jhtml, child);
331 if (*name == 's' || *name == 'S') {
332 /*----------------------------------------------------------------------*/
334 /*----------------------------------------------------------------------*/
335 if (strcasecmp(name, "select") == 0) {
336 s_jhtml_start_select_tag(jhtml, child);
337 s_jhtml_node_exchange (jhtml, child, indent+1);
338 s_jhtml_end_select_tag (jhtml, child);
340 /*----------------------------------------------------------------------*/
341 /* <STYLE> (for TEST) */
342 /*----------------------------------------------------------------------*/
344 if (strcasecmp(name, "style") == 0) {
345 s_jhtml_node_exchange (jhtml, child, indent+1);
347 /*----------------------------------------------------------------------*/
348 /* <SPAN> (for TEST) */
349 /*----------------------------------------------------------------------*/
351 if (strcasecmp(name, "span") == 0) {
352 s_jhtml_node_exchange (jhtml, child, indent+1);
355 /*------------------------------------------------------------------------*/
357 /*------------------------------------------------------------------------*/
359 if ((*name == 'o' || *name == 'O')
360 && strcasecmp(name, "option") == 0) {
361 s_jhtml_start_option_tag(jhtml, child);
362 s_jhtml_node_exchange (jhtml, child, indent+1);
363 s_jhtml_end_option_tag (jhtml, child);
365 /*------------------------------------------------------------------------*/
367 /*------------------------------------------------------------------------*/
369 if ((*name == 'd' || *name == 'D')
370 && strcasecmp(name, "div") == 0) {
371 s_jhtml_start_div_tag (jhtml, child);
372 s_jhtml_node_exchange (jhtml, child, indent+1);
373 s_jhtml_end_div_tag (jhtml, child);
375 /*------------------------------------------------------------------------*/
377 /*------------------------------------------------------------------------*/
379 if ((*name == 'b' || *name == 'B')
380 && strcasecmp(name, "blink") == 0) {
383 /*------------------------------------------------------------------------*/
385 /*------------------------------------------------------------------------*/
387 if (*name == 'c' || *name == 'C') {
388 if (strcasecmp(name, "center") == 0) {
389 s_jhtml_start_center_tag(jhtml, child);
390 s_jhtml_node_exchange (jhtml, child,indent+1);
391 s_jhtml_end_center_tag (jhtml, child);
393 /*----------------------------------------------------------------------*/
395 /*----------------------------------------------------------------------*/
397 if (strcasecmp(name, "chxj:if") == 0) {
398 ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
399 if (chxj_chxjif_is_mine(jhtml->spec, doc, child)) {
400 ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
402 char* parse_attr = NULL;
403 parse_attr = qs_get_parse_attr(doc, child, r);
404 if (parse_attr != NULL && strcasecmp(parse_attr, "true") == 0) {
405 s_jhtml_node_exchange (jhtml, child, indent+1);
408 s_jhtml_chxjif_tag(jhtml, child);
414 if (*name == 't' || *name == 'T') {
415 /*------------------------------------------------------------------------*/
417 /*------------------------------------------------------------------------*/
418 if (strcasecmp(name, "title") == 0) {
419 s_jhtml_start_title_tag (jhtml, child);
420 s_jhtml_node_exchange (jhtml, child,indent+1);
421 s_jhtml_end_title_tag (jhtml, child);
423 /*------------------------------------------------------------------------*/
424 /* <TABLE> (for TEST) */
425 /*------------------------------------------------------------------------*/
427 if (strcasecmp(name, "table") == 0) {
428 s_jhtml_node_exchange (jhtml, child, indent+1);
430 /*------------------------------------------------------------------------*/
431 /* <TBODY> (for TEST) */
432 /*------------------------------------------------------------------------*/
434 if (strcasecmp(name, "tbody") == 0) {
435 s_jhtml_node_exchange (jhtml, child, indent+1);
437 /*------------------------------------------------------------------------*/
438 /* <TH> (for TEST) */
439 /*------------------------------------------------------------------------*/
441 if (strcasecmp(name, "th") == 0) {
442 s_jhtml_node_exchange (jhtml, child, indent+1);
444 /*------------------------------------------------------------------------*/
445 /* <TR> (for TEST) */
446 /*------------------------------------------------------------------------*/
448 if (strcasecmp(name, "tr") == 0) {
449 s_jhtml_start_tr_tag (jhtml, child);
450 s_jhtml_node_exchange (jhtml, child,indent+1);
451 s_jhtml_end_tr_tag (jhtml, child);
453 /*------------------------------------------------------------------------*/
454 /* <TD> (for TEST) */
455 /*------------------------------------------------------------------------*/
457 if (strcasecmp(name, "td") == 0) {
458 s_jhtml_node_exchange (jhtml, child, indent+1);
460 /*------------------------------------------------------------------------*/
462 /*------------------------------------------------------------------------*/
464 if (strcasecmp(name, "text") == 0) {
472 textval = qs_get_node_value(doc,child);
473 textval = qs_trim_string(jhtml->doc->r, textval);
474 if (strlen(textval) == 0)
477 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
478 memset(tmp, 0, qs_get_node_size(doc,child)+1);
480 tdst = qs_alloc_zero_byte_string(r);
481 memset(one_byte, 0, sizeof(one_byte));
484 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
486 int rtn = s_jhtml_search_emoji(jhtml, &textval[ii], &out);
488 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
493 if (is_sjis_kanji(textval[ii])) {
494 one_byte[0] = textval[ii+0];
495 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
496 one_byte[0] = textval[ii+1];
497 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
501 if (textval[ii] != '\r' && textval[ii] != '\n') {
502 one_byte[0] = textval[ii+0];
503 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
506 jhtml->out = apr_pstrcat(r->pool, jhtml->out, tdst, NULL);
514 * Corresponding EMOJI to a current character-code is retrieved.
515 * The substitution character string is stored in the rslt pointer if agreeing.
517 * @param jhtml [i] The pointer to the CHTML structure is specified.
518 * @param txt [i] The character string to want to examine whether it is
519 * EMOJI is specified.
520 * @param rslt [o] The pointer to the pointer that stores the result is
522 * @return When corresponding EMOJI exists, it returns it excluding 0.
525 s_jhtml_search_emoji(jhtml_t* jhtml, char* txt, char** rslt)
529 device_table_t* spec;
538 ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
540 for (ee = jhtml->conf->emoji;
543 unsigned char hex1byte;
544 unsigned char hex2byte;
545 if (ee->imode == NULL) {
546 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
547 "emoji->imode is NULL");
550 hex1byte = ee->imode->hex1byte & 0xff;
551 hex2byte = ee->imode->hex2byte & 0xff;
553 if (ee->imode->string != NULL
554 && strlen(ee->imode->string) > 0
555 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
556 if (spec == NULL || spec->emoji_type == NULL) {
557 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
558 return strlen(ee->imode->string);
564 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
565 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
566 if (spec == NULL || spec->emoji_type == NULL) {
567 *rslt = apr_psprintf(r->pool,"
\e%s
\ f", ee->jphone->string);
578 * It is a handler who processes the HTML tag.
580 * @param jhtml [i/o] The pointer to the CHTML structure at the output
581 * destination is specified.
582 * @param node [i] The HTML tag node is specified.
583 * @return The conversion result is returned.
586 s_jhtml_start_html_tag(jhtml_t* jhtml, Node* node)
588 Doc* doc = jhtml->doc;
589 request_rec* r = doc->r;
591 /*--------------------------------------------------------------------------*/
593 /*--------------------------------------------------------------------------*/
594 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<html>\n", NULL);
600 * It is a handler who processes the HTML tag.
602 * @param jhtml [i/o] The pointer to the CHTML structure at the output
603 * destination is specified.
604 * @param node [i] The HTML tag node is specified.
605 * @return The conversion result is returned.
608 s_jhtml_end_html_tag(jhtml_t* jhtml, Node* child)
610 Doc* doc = jhtml->doc;
611 request_rec* r = doc->r;
613 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</html>\n", NULL);
619 * It is a handler who processes the META tag.
621 * @param jhtml [i/o] The pointer to the CHTML structure at the output
622 * destination is specified.
623 * @param node [i] The META tag node is specified.
624 * @return The conversion result is returned.
627 s_jhtml_start_meta_tag(jhtml_t* jhtml, Node* node)
629 Doc* doc = jhtml->doc;
630 request_rec* r = doc->r;
633 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<meta", NULL);
635 /*--------------------------------------------------------------------------*/
637 /*--------------------------------------------------------------------------*/
638 for (attr = qs_get_attr(doc,node);
640 attr = qs_get_next_attr(doc,attr)) {
641 char* name = qs_get_attr_name(doc,attr);
642 char* value = qs_get_attr_value(doc,attr);
644 if (strcasecmp(name, "http-equiv") == 0) {
645 /*----------------------------------------------------------------------*/
647 /*----------------------------------------------------------------------*/
648 jhtml->out = apr_pstrcat(r->pool,
656 if (strcasecmp(name, "content") == 0) {
657 /*----------------------------------------------------------------------*/
659 /*----------------------------------------------------------------------*/
660 jhtml->out = apr_pstrcat(r->pool,
668 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
673 * It is a handler who processes the META tag.
675 * @param jhtml [i/o] The pointer to the CHTML structure at the output
676 * destination is specified.
677 * @param node [i] The META tag node is specified.
678 * @return The conversion result is returned.
681 s_jhtml_end_meta_tag(jhtml_t* jhtml, Node* child)
687 * It is a handler who processes the HEAD tag.
689 * @param jhtml [i/o] The pointer to the CHTML structure at the output
690 * destination is specified.
691 * @param node [i] The HEAD tag node is specified.
692 * @return The conversion result is returned.
695 s_jhtml_start_head_tag(jhtml_t* jhtml, Node* node)
697 Doc* doc = jhtml->doc;
698 request_rec* r = doc->r;
700 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<head>\r\n", NULL);
706 * It is a handler who processes the HEAD tag.
708 * @param jhtml [i/o] The pointer to the CHTML structure at the output
709 * destination is specified.
710 * @param node [i] The HEAD tag node is specified.
711 * @return The conversion result is returned.
714 s_jhtml_end_head_tag(jhtml_t* jhtml, Node* child)
716 Doc* doc = jhtml->doc;
717 request_rec* r = doc->r;
719 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</head>\r\n", NULL);
725 * It is a handler who processes the TITLE tag.
727 * @param jhtml [i/o] The pointer to the CHTML structure at the output
728 * destination is specified.
729 * @param node [i] The TITLE tag node is specified.
730 * @return The conversion result is returned.
733 s_jhtml_start_title_tag(jhtml_t* jhtml, Node* node)
735 Doc* doc = jhtml->doc;
736 request_rec* r = doc->r;
738 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<title>", NULL);
744 * It is a handler who processes the TITLE tag.
746 * @param jhtml [i/o] The pointer to the CHTML structure at the output
747 * destination is specified.
748 * @param node [i] The TITLE tag node is specified.
749 * @return The conversion result is returned.
752 s_jhtml_end_title_tag(jhtml_t* jhtml, Node* child)
754 Doc* doc = jhtml->doc;
755 request_rec* r = doc->r;
757 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</title>\r\n", NULL);
763 * It is a handler who processes the BASE tag.
765 * @param jhtml [i/o] The pointer to the CHTML structure at the output
766 * destination is specified.
767 * @param node [i] The BASE tag node is specified.
768 * @return The conversion result is returned.
771 s_jhtml_start_base_tag(jhtml_t* jhtml, Node* node)
774 Doc* doc = jhtml->doc;
775 request_rec* r = doc->r;
777 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<base", NULL);
779 /*--------------------------------------------------------------------------*/
781 /*--------------------------------------------------------------------------*/
782 for (attr = qs_get_attr(doc,node);
784 attr = qs_get_next_attr(doc,attr)) {
785 char* name = qs_get_attr_name(doc,attr);
786 char* value = qs_get_attr_value(doc,attr);
787 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
788 jhtml->out = apr_pstrcat(r->pool,
797 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >\r\n", NULL);
803 * It is a handler who processes the BASE tag.
805 * @param jhtml [i/o] The pointer to the CHTML structure at the output
806 * destination is specified.
807 * @param node [i] The BASE tag node is specified.
808 * @return The conversion result is returned.
811 s_jhtml_end_base_tag(jhtml_t* jhtml, Node* child)
817 * It is a handler who processes the BODY tag.
819 * @param jhtml [i/o] The pointer to the CHTML structure at the output
820 * destination is specified.
821 * @param node [i] The BODY tag node is specified.
822 * @return The conversion result is returned.
825 s_jhtml_start_body_tag(jhtml_t* jhtml, Node* node)
827 Doc* doc = jhtml->doc;
828 request_rec* r = doc->r;
831 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<body", NULL);
833 /*--------------------------------------------------------------------------*/
835 /*--------------------------------------------------------------------------*/
836 for (attr = qs_get_attr(doc,node);
838 attr = qs_get_next_attr(doc,attr)) {
839 char* name = qs_get_attr_name(doc,attr);
840 char* value = qs_get_attr_value(doc,attr);
842 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
843 /*----------------------------------------------------------------------*/
845 /*----------------------------------------------------------------------*/
846 jhtml->out = apr_pstrcat(r->pool,
854 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
855 /*----------------------------------------------------------------------*/
857 /*----------------------------------------------------------------------*/
858 jhtml->out = apr_pstrcat(r->pool,
866 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
867 /*----------------------------------------------------------------------*/
869 /*----------------------------------------------------------------------*/
870 jhtml->out = apr_pstrcat(r->pool,
878 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
879 /*----------------------------------------------------------------------*/
881 /*----------------------------------------------------------------------*/
885 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
886 /*----------------------------------------------------------------------*/
888 /*----------------------------------------------------------------------*/
892 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\r\n", NULL);
898 * It is a handler who processes the BODY tag.
900 * @param jhtml [i/o] The pointer to the CHTML structure at the output
901 * destination is specified.
902 * @param node [i] The BODY tag node is specified.
903 * @return The conversion result is returned.
906 s_jhtml_end_body_tag(jhtml_t* jhtml, Node* child)
908 Doc* doc = jhtml->doc;
909 request_rec* r = doc->r;
911 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</body>\r\n", NULL);
917 * It is a handler who processes the A tag.
919 * @param jhtml [i/o] The pointer to the CHTML structure at the output
920 * destination is specified.
921 * @param node [i] The A tag node is specified.
922 * @return The conversion result is returned.
925 s_jhtml_start_a_tag(jhtml_t* jhtml, Node* node)
927 Doc* doc = jhtml->doc;
928 request_rec* r = doc->r;
931 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<a", NULL);
933 /*--------------------------------------------------------------------------*/
935 /*--------------------------------------------------------------------------*/
936 for (attr = qs_get_attr(doc,node);
938 attr = qs_get_next_attr(doc,attr)) {
939 char* name = qs_get_attr_name(doc,attr);
940 char* value = qs_get_attr_value(doc,attr);
942 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
943 /*----------------------------------------------------------------------*/
945 /*----------------------------------------------------------------------*/
946 jhtml->out = apr_pstrcat(r->pool,
954 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
955 /*----------------------------------------------------------------------*/
957 /*----------------------------------------------------------------------*/
958 jhtml->out = apr_pstrcat(r->pool,
966 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
967 /*----------------------------------------------------------------------*/
969 /*----------------------------------------------------------------------*/
970 jhtml->out = apr_pstrcat(r->pool,
978 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
979 /*----------------------------------------------------------------------*/
981 /*----------------------------------------------------------------------*/
982 jhtml->out = apr_pstrcat(r->pool,
990 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
991 /*----------------------------------------------------------------------*/
993 /*----------------------------------------------------------------------*/
997 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
998 /*----------------------------------------------------------------------*/
1000 /* It is special only for CHTML. */
1001 /*----------------------------------------------------------------------*/
1002 jhtml->out = apr_pstrcat(r->pool,
1008 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1009 /*----------------------------------------------------------------------*/
1011 /*----------------------------------------------------------------------*/
1015 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1016 /*----------------------------------------------------------------------*/
1018 /*----------------------------------------------------------------------*/
1022 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1023 /*----------------------------------------------------------------------*/
1025 /*----------------------------------------------------------------------*/
1029 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1030 /*----------------------------------------------------------------------*/
1032 /*----------------------------------------------------------------------*/
1036 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1037 /*----------------------------------------------------------------------*/
1039 /*----------------------------------------------------------------------*/
1043 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1044 /*----------------------------------------------------------------------*/
1046 /*----------------------------------------------------------------------*/
1050 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1051 /*----------------------------------------------------------------------*/
1053 /*----------------------------------------------------------------------*/
1058 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1064 * It is a handler who processes the A tag.
1066 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1067 * destination is specified.
1068 * @param node [i] The A tag node is specified.
1069 * @return The conversion result is returned.
1072 s_jhtml_end_a_tag(jhtml_t* jhtml, Node* child)
1074 Doc* doc = jhtml->doc;
1075 request_rec* r = doc->r;
1077 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</a>", NULL);
1083 * It is a handler who processes the BR tag.
1085 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1086 * destination is specified.
1087 * @param node [i] The BR tag node is specified.
1088 * @return The conversion result is returned.
1091 s_jhtml_start_br_tag(jhtml_t* jhtml, Node* node)
1093 Doc* doc = jhtml->doc;
1094 request_rec* r = doc->r;
1096 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<br>\r\n", NULL);
1102 * It is a handler who processes the BR tag.
1104 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1105 * destination is specified.
1106 * @param node [i] The BR tag node is specified.
1107 * @return The conversion result is returned.
1110 s_jhtml_end_br_tag(jhtml_t* jhtml, Node* child)
1116 * It is a handler who processes the TR tag.
1118 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1119 * destination is specified.
1120 * @param node [i] The TR tag node is specified.
1121 * @return The conversion result is returned.
1124 s_jhtml_start_tr_tag(jhtml_t* jhtml, Node* node)
1126 Doc* doc = jhtml->doc;
1127 request_rec* r = doc->r;
1129 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<br>\r\n", NULL);
1135 * It is a handler who processes the TR tag.
1137 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1138 * destination is specified.
1139 * @param node [i] The TR tag node is specified.
1140 * @return The conversion result is returned.
1143 s_jhtml_end_tr_tag(jhtml_t* jhtml, Node* child)
1149 * It is a handler who processes the FONT tag.
1151 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1152 * destination is specified.
1153 * @param node [i] The FONT tag node is specified.
1154 * @return The conversion result is returned.
1157 s_jhtml_start_font_tag(jhtml_t* jhtml, Node* node)
1159 Doc* doc = jhtml->doc;
1160 request_rec* r = doc->r;
1163 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<font", NULL);
1165 /*--------------------------------------------------------------------------*/
1166 /* Get Attributes */
1167 /*--------------------------------------------------------------------------*/
1168 for (attr = qs_get_attr(doc,node);
1170 attr = qs_get_next_attr(doc,attr)) {
1171 char* name = qs_get_attr_name(doc,attr);
1172 char* value = qs_get_attr_value(doc,attr);
1174 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1175 jhtml->out = apr_pstrcat(r->pool,
1183 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1184 /*----------------------------------------------------------------------*/
1186 /*----------------------------------------------------------------------*/
1191 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1197 * It is a handler who processes the FONT tag.
1199 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1200 * destination is specified.
1201 * @param node [i] The FONT tag node is specified.
1202 * @return The conversion result is returned.
1205 s_jhtml_end_font_tag(jhtml_t* jhtml, Node* child)
1207 request_rec* r = jhtml->doc->r;
1209 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</font>", NULL);
1215 * It is a handler who processes the FORM tag.
1217 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1218 * destination is specified.
1219 * @param node [i] The FORM tag node is specified.
1220 * @return The conversion result is returned.
1223 s_jhtml_start_form_tag(jhtml_t* jhtml, Node* node)
1225 Doc* doc = jhtml->doc;
1226 request_rec* r = doc->r;
1229 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<form", NULL);
1231 /*--------------------------------------------------------------------------*/
1232 /* Get Attributes */
1233 /*--------------------------------------------------------------------------*/
1234 for (attr = qs_get_attr(doc,node);
1236 attr = qs_get_next_attr(doc,attr)) {
1237 char* name = qs_get_attr_name(doc,attr);
1238 char* value = qs_get_attr_value(doc,attr);
1240 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1241 /*----------------------------------------------------------------------*/
1243 /*----------------------------------------------------------------------*/
1244 jhtml->out = apr_pstrcat(r->pool,
1252 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "method") == 0) {
1253 /*----------------------------------------------------------------------*/
1255 /*----------------------------------------------------------------------*/
1256 jhtml->out = apr_pstrcat(r->pool,
1264 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1265 /*----------------------------------------------------------------------*/
1267 /* It is special only for CHTML. */
1268 /*----------------------------------------------------------------------*/
1269 jhtml->out = apr_pstrcat(r->pool,
1276 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1282 * It is a handler who processes the FORM tag.
1284 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1285 * destination is specified.
1286 * @param node [i] The FORM tag node is specified.
1287 * @return The conversion result is returned.
1290 s_jhtml_end_form_tag(jhtml_t* jhtml, Node* child)
1292 Doc* doc = jhtml->doc;
1293 request_rec* r = doc->r;
1295 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</form>", NULL);
1301 * It is a handler who processes the INPUT tag.
1303 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1304 * destination is specified.
1305 * @param node [i] The INPUT tag node is specified.
1306 * @return The conversion result is returned.
1309 s_jhtml_start_input_tag(jhtml_t* jhtml, Node* node)
1311 Doc* doc = jhtml->doc;
1312 request_rec* r = doc->r;
1313 char* max_length = NULL;
1317 char* istyle = NULL;
1319 char* checked = NULL;
1320 char* accesskey = NULL;
1322 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<input", NULL);
1324 /*--------------------------------------------------------------------------*/
1325 /* Get Attributes */
1326 /*--------------------------------------------------------------------------*/
1328 type = qs_get_type_attr(doc, node, r);
1329 name = qs_get_name_attr(doc, node, r);
1330 value = qs_get_value_attr(doc,node,r);
1331 istyle = qs_get_istyle_attr(doc,node,r);
1332 max_length = qs_get_maxlength_attr(doc,node,r);
1333 checked = qs_get_checked_attr(doc,node,r);
1334 accesskey = qs_get_accesskey_attr(doc, node, r);
1335 size = qs_get_size_attr(doc, node, r);
1338 jhtml->out = apr_pstrcat(r->pool,
1346 jhtml->out = apr_pstrcat(r->pool,
1354 jhtml->out = apr_pstrcat(r->pool,
1362 jhtml->out = apr_pstrcat(r->pool,
1370 jhtml->out = apr_pstrcat(r->pool,
1377 /*------------------------------------------------------------------------*/
1379 /*------------------------------------------------------------------------*/
1380 if (type && (*type == 'p' || *type == 'P') && strcasecmp(type, "password") == 0) {
1381 jhtml->out = apr_pstrcat(r->pool,
1388 jhtml->out = apr_pstrcat(r->pool,
1391 chxj_istyle_to_mode(r,istyle), "\" ",
1396 if (istyle == NULL && type != NULL && strcasecmp(type, "password") == 0) {
1397 jhtml->out = apr_pstrcat(r->pool,
1403 /*--------------------------------------------------------------------------*/
1404 /* The figure is default for the password. */
1405 /*--------------------------------------------------------------------------*/
1407 jhtml->out = apr_pstrcat(r->pool,
1416 jhtml->out = apr_pstrcat(r->pool,
1417 jhtml->out, " checked ", NULL);
1420 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
1426 * It is a handler who processes the INPUT tag.
1428 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1429 * destination is specified.
1430 * @param node [i] The INPUT tag node is specified.
1431 * @return The conversion result is returned.
1434 s_jhtml_end_input_tag(jhtml_t* jhtml, Node* child)
1440 * It is a handler who processes the CENTER tag.
1442 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1443 * destination is specified.
1444 * @param node [i] The CENTER tag node is specified.
1445 * @return The conversion result is returned.
1448 s_jhtml_start_center_tag(jhtml_t* jhtml, Node* node)
1450 Doc* doc = jhtml->doc;
1451 request_rec* r = doc->r;
1453 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<center>", NULL);
1459 * It is a handler who processes the CENTER tag.
1461 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1462 * destination is specified.
1463 * @param node [i] The CENTER tag node is specified.
1464 * @return The conversion result is returned.
1467 s_jhtml_end_center_tag(jhtml_t* jhtml, Node* child)
1469 Doc* doc = jhtml->doc;
1470 request_rec* r = doc->r;
1472 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</center>", NULL);
1478 * It is a handler who processes the li tag.
1480 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1481 * destination is specified.
1482 * @param node [i] The li tag node is specified.
1483 * @return The conversion result is returned.
1486 s_jhtml_start_li_tag(jhtml_t* jhtml, Node* node)
1488 Doc* doc = jhtml->doc;
1489 request_rec* r = doc->r;
1491 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<li>", NULL);
1497 * It is a handler who processes the li tag.
1499 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1500 * destination is specified.
1501 * @param node [i] The li tag node is specified.
1502 * @return The conversion result is returned.
1505 s_jhtml_end_li_tag(jhtml_t* jhtml, Node* child)
1507 Doc* doc = jhtml->doc;
1508 request_rec* r = doc->r;
1510 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</li>", NULL);
1516 * It is a handler who processes the OL tag.
1518 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1519 * destination is specified.
1520 * @param node [i] The OL tag node is specified.
1521 * @return The conversion result is returned.
1524 s_jhtml_start_ol_tag(jhtml_t* jhtml, Node* node)
1526 Doc* doc = jhtml->doc;
1527 request_rec* r = doc->r;
1529 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ol>", NULL);
1535 * It is a handler who processes the OL tag.
1537 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1538 * destination is specified.
1539 * @param node [i] The OL tag node is specified.
1540 * @return The conversion result is returned.
1543 s_jhtml_end_ol_tag(jhtml_t* jhtml, Node* child)
1545 Doc* doc = jhtml->doc;
1546 request_rec* r = doc->r;
1548 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ol>", NULL);
1554 * It is a handler who processes the UL tag.
1556 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1557 * destination is specified.
1558 * @param node [i] The UL tag node is specified.
1559 * @return The conversion result is returned.
1562 s_jhtml_start_ul_tag(jhtml_t* jhtml, Node* node)
1564 Doc* doc = jhtml->doc;
1565 request_rec* r = doc->r;
1567 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ul>", NULL);
1573 * It is a handler who processes the UL tag.
1575 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1576 * destination is specified.
1577 * @param node [i] The UL tag node is specified.
1578 * @return The conversion result is returned.
1581 s_jhtml_end_ul_tag(jhtml_t* jhtml, Node* child)
1583 Doc* doc = jhtml->doc;
1584 request_rec* r = doc->r;
1586 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ul>", NULL);
1592 * It is a handler who processes the HR tag.
1594 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1595 * destination is specified.
1596 * @param node [i] The HR tag node is specified.
1597 * @return The conversion result is returned.
1600 s_jhtml_start_hr_tag(jhtml_t* jhtml, Node* node)
1602 Doc* doc = jhtml->doc;
1603 request_rec* r = doc->r;
1606 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<hr ", NULL);
1608 for (attr = qs_get_attr(doc,node);
1610 attr = qs_get_next_attr(doc,attr)) {
1611 char* name = qs_get_attr_name(doc,attr);
1612 char* value = qs_get_attr_value(doc,attr);
1613 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
1614 /*----------------------------------------------------------------------*/
1616 /*----------------------------------------------------------------------*/
1617 jhtml->out = apr_pstrcat(r->pool,
1619 " align=\"", value, "\" ", NULL);
1622 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1623 /*----------------------------------------------------------------------*/
1625 /*----------------------------------------------------------------------*/
1626 jhtml->out = apr_pstrcat(r->pool,
1628 " size=\"", value, "\" ", NULL);
1631 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width") == 0) {
1632 /*----------------------------------------------------------------------*/
1634 /*----------------------------------------------------------------------*/
1635 jhtml->out = apr_pstrcat(r->pool,
1637 " width=\"", value, "\" ", NULL);
1640 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "noshade") == 0) {
1641 /*----------------------------------------------------------------------*/
1643 /*----------------------------------------------------------------------*/
1644 jhtml->out = apr_pstrcat(r->pool,
1649 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
1650 /*----------------------------------------------------------------------*/
1652 /*----------------------------------------------------------------------*/
1656 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
1662 * It is a handler who processes the HR tag.
1664 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1665 * destination is specified.
1666 * @param node [i] The HR tag node is specified.
1667 * @return The conversion result is returned.
1670 s_jhtml_end_hr_tag(jhtml_t* jhtml, Node* child)
1676 * It is a handler who processes the IMG tag.
1678 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1679 * destination is specified.
1680 * @param node [i] The IMG tag node is specified.
1681 * @return The conversion result is returned.
1684 s_jhtml_start_img_tag(jhtml_t* jhtml, Node* node)
1686 Doc* doc = jhtml->doc;
1687 request_rec* r = doc->r;
1689 #ifndef IMG_NOT_CONVERT_FILENAME
1690 device_table_t* spec = jhtml->spec;
1693 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<img", NULL);
1696 /*--------------------------------------------------------------------------*/
1697 /* Get Attributes */
1698 /*--------------------------------------------------------------------------*/
1699 for (attr = qs_get_attr(doc,node);
1701 attr = qs_get_next_attr(doc,attr)) {
1702 char* name = qs_get_attr_name(doc,attr);
1703 char* value = qs_get_attr_value(doc,attr);
1705 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
1706 /*----------------------------------------------------------------------*/
1708 /*----------------------------------------------------------------------*/
1709 #ifdef IMG_NOT_CONVERT_FILENAME
1710 jhtml->out = apr_pstrcat(r->pool,
1711 jhtml->out, " src=\"",value,"\"", NULL);
1713 jhtml->out = apr_pstrcat(r->pool,
1714 jhtml->out, " src=\"", chxj_img_conv(r,spec,value), NULL);
1715 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "\"", NULL);
1719 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
1720 /*----------------------------------------------------------------------*/
1722 /*----------------------------------------------------------------------*/
1723 jhtml->out = apr_pstrcat(r->pool,
1724 jhtml->out, " align=\"",value,"\"", NULL);
1727 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
1728 /*----------------------------------------------------------------------*/
1730 /*----------------------------------------------------------------------*/
1731 jhtml->out = apr_pstrcat(r->pool,
1732 jhtml->out, " width=\"",value,"\"", NULL);
1735 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
1736 /*----------------------------------------------------------------------*/
1738 /*----------------------------------------------------------------------*/
1739 jhtml->out = apr_pstrcat(r->pool,
1740 jhtml->out, " height=\"",value,"\"", NULL);
1743 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
1744 /*----------------------------------------------------------------------*/
1746 /*----------------------------------------------------------------------*/
1747 jhtml->out = apr_pstrcat(r->pool,
1748 jhtml->out, " hspace=\"",value,"\"", NULL);
1751 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
1752 /*----------------------------------------------------------------------*/
1754 /*----------------------------------------------------------------------*/
1755 jhtml->out = apr_pstrcat(r->pool,
1756 jhtml->out, " vspace=\"",value,"\"", NULL);
1759 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
1760 /*----------------------------------------------------------------------*/
1762 /*----------------------------------------------------------------------*/
1763 jhtml->out = apr_pstrcat(r->pool,
1764 jhtml->out, " alt=\"",value,"\"", NULL);
1767 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
1768 /*----------------------------------------------------------------------*/
1770 /*----------------------------------------------------------------------*/
1775 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1781 * It is a handler who processes the IMG tag.
1783 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1784 * destination is specified.
1785 * @param node [i] The IMG tag node is specified.
1786 * @return The conversion result is returned.
1789 s_jhtml_end_img_tag(jhtml_t* jhtml, Node* child)
1795 * It is a handler who processes the SELECT tag.
1797 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1798 * destination is specified.
1799 * @param node [i] The SELECT tag node is specified.
1800 * @return The conversion result is returned.
1803 s_jhtml_start_select_tag(jhtml_t* jhtml, Node* child)
1805 Doc* doc = jhtml->doc;
1806 request_rec* r = doc->r;
1812 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<select", NULL);
1813 for (attr = qs_get_attr(doc,child);
1815 attr = qs_get_next_attr(doc,attr)) {
1816 char* nm = qs_get_attr_name(doc,attr);
1817 char* val = qs_get_attr_value(doc,attr);
1819 if ((*name == 's' || *name == 'S') && strcasecmp(nm, "size") == 0) {
1820 /*----------------------------------------------------------------------*/
1821 /* CHTML 1.0 version 2.0 */
1822 /*----------------------------------------------------------------------*/
1823 size = apr_pstrdup(r->pool, val);
1826 if (strcasecmp(nm, "name") == 0) {
1827 /*----------------------------------------------------------------------*/
1828 /* CHTML 1.0 version 2.0 */
1829 /*----------------------------------------------------------------------*/
1830 name = apr_pstrdup(r->pool, val);
1833 if (strcasecmp(nm, "multiple") == 0) {
1834 /*----------------------------------------------------------------------*/
1835 /* CHTML 1.0 version 2.0 */
1836 /*----------------------------------------------------------------------*/
1843 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " size=\"",size,"\"", NULL);
1847 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",name,"\"", NULL);
1849 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\n", NULL);
1854 * It is a handler who processes the SELECT tag.
1856 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1857 * destination is specified.
1858 * @param node [i] The SELECT tag node is specified.
1859 * @return The conversion result is returned.
1862 s_jhtml_end_select_tag(jhtml_t* jhtml, Node* child)
1864 Doc* doc = jhtml->doc;
1865 request_rec* r = doc->r;
1867 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</select>\n", NULL);
1872 * It is a handler who processes the OPTION tag.
1874 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1875 * destination is specified.
1876 * @param node [i] The OPTION tag node is specified.
1877 * @return The conversion result is returned.
1880 s_jhtml_start_option_tag(jhtml_t* jhtml, Node* child)
1882 Doc* doc = jhtml->doc;
1883 request_rec* r = doc->r;
1886 char* selected = NULL;
1889 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<option", NULL);
1890 for (attr = qs_get_attr(doc,child);
1892 attr = qs_get_next_attr(doc,attr))
1894 char* nm = qs_get_attr_name(doc,attr);
1895 char* val = qs_get_attr_value(doc,attr);
1897 if (strcasecmp(nm, "selected") == 0)
1899 /*----------------------------------------------------------------------*/
1900 /* CHTML 1.0 version 2.0 */
1901 /*----------------------------------------------------------------------*/
1902 selected = apr_pstrdup(r->pool, val);
1905 if (strcasecmp(nm, "value") == 0)
1907 /*----------------------------------------------------------------------*/
1908 /* CHTML 1.0 version 2.0 */
1909 /*----------------------------------------------------------------------*/
1910 value = apr_pstrdup(r->pool, val);
1916 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"",value,"\"", NULL);
1920 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"\"", NULL);
1923 if (selected != NULL)
1925 jhtml->out = apr_pstrcat(r->pool, jhtml->out, " selected ", NULL);
1928 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1933 * It is a handler who processes the OPTION tag.
1935 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1936 * destination is specified.
1937 * @param node [i] The OPTION tag node is specified.
1938 * @return The conversion result is returned.
1941 s_jhtml_end_option_tag(jhtml_t* jhtml, Node* child)
1948 * It is a handler who processes the DIV tag.
1950 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1951 * destination is specified.
1952 * @param node [i] The DIV tag node is specified.
1953 * @return The conversion result is returned.
1956 s_jhtml_start_div_tag(jhtml_t* jhtml, Node* child)
1958 Doc* doc = jhtml->doc;
1959 request_rec* r = doc->r;
1964 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<div", NULL);
1965 for (attr = qs_get_attr(doc,child);
1967 attr = qs_get_next_attr(doc,attr))
1969 char* nm = qs_get_attr_name(doc,attr);
1970 char* val = qs_get_attr_value(doc,attr);
1972 if (strcasecmp(nm, "align") == 0)
1974 /*----------------------------------------------------------------------*/
1975 /* CHTML 1.0 (W3C version 3.2) */
1976 /*----------------------------------------------------------------------*/
1977 align = apr_pstrdup(r->pool, val);
1983 jhtml->out = apr_pstrcat(r->pool,
1984 jhtml->out, " align=\"", align, "\"", NULL);
1987 jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
1992 * It is a handler who processes the DIV tag.
1994 * @param jhtml [i/o] The pointer to the CHTML structure at the output
1995 * destination is specified.
1996 * @param node [i] The DIV tag node is specified.
1997 * @return The conversion result is returned.
2000 s_jhtml_end_div_tag(jhtml_t* jhtml, Node* child)
2002 Doc* doc = jhtml->doc;
2003 request_rec* r = doc->r;
2005 jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</div>\n", NULL);
2011 chxj_istyle_to_mode(request_rec* r, const char* s)
2014 if (strcasecmp(s, "1") == 0)
2016 return apr_psprintf(r->pool, "hiragana");
2019 if (strcasecmp(s, "2") == 0)
2021 return apr_psprintf(r->pool, "hankakukana");
2024 if (strcasecmp(s, "3") == 0)
2026 return apr_psprintf(r->pool, "alphabet");
2029 if (strcasecmp(s, "4") == 0)
2031 return apr_psprintf(r->pool, "numeric");
2034 tmp = apr_palloc(r->pool, 1);
2036 return apr_pstrdup(r->pool,tmp);
2040 s_jhtml_chxjif_tag(jhtml_t* jhtml, Node* node)
2042 Doc* doc = jhtml->doc;
2044 request_rec* r = doc->r;
2046 for (child = qs_get_child_node(doc, node);
2048 child = qs_get_next_node(doc, child))
2050 jhtml->out = apr_pstrcat(r->pool, jhtml->out, child->otext, NULL);
2051 s_jhtml_chxjif_tag(jhtml, child);