/*
+ * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
* Copyright (C) 2005 QSDN,Inc. All rights reserved.
- * Copyright (C) 2005 Atsushi Konno All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "chxj_img_conv.h"
#include "chxj_qr_code.h"
#include "chxj_encoding.h"
-
-#define GET_JHTML(X) ((jhtml_t*)(X))
-
-static char* s_jhtml_start_html_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_html_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_meta_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_meta_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_head_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_head_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_title_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_title_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_base_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_base_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_body_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_body_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_a_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_a_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_pre_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_pre_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_p_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_p_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_ul_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_ul_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_ol_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_ol_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_li_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_li_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_br_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_br_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_tr_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_tr_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_font_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_font_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_form_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_form_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_input_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_input_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_center_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_center_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_hr_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_hr_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_img_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_img_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_select_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_select_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_option_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_option_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_div_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_div_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_textarea_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_textarea_tag (void* pdoc, Node* node);
-static char* s_jhtml_start_b_tag (void* pdoc, Node* node);
-static char* s_jhtml_end_b_tag (void* pdoc, Node* node);
-static char* s_jhtml_chxjif_tag (void* pdoc, Node* node);
-static char* s_jhtml_text_tag (void* pdoc, Node* node);
-
-static void s_init_jhtml(jhtml_t* jhtml, Doc* doc, request_rec* r, device_table* spec);
-
-static int s_jhtml_search_emoji(jhtml_t* jhtml, char* txt, char** rslt);
-
-static char* chxj_istyle_to_mode(request_rec* r, const char* s);
+#include "chxj_url_encode.h"
+#include "chxj_str_util.h"
+
+
+#define GET_JHTML(X) ((jhtml_t *)(X))
+#undef W_L
+#undef W_V
+#define W_L(X) do { jhtml->out = BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, (X)); } while(0)
+#define W_V(X) do { jhtml->out = (X) ? BUFFERED_WRITE_VALUE(jhtml->out, &doc->buf, (X)) \
+ : BUFFERED_WRITE_LITERAL(jhtml->out, &doc->buf, ""); } while(0)
+
+static char *s_jhtml_start_html_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_html_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_meta_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_meta_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_head_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_head_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_title_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_title_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_base_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_base_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_body_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_body_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_a_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_a_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_pre_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_pre_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_p_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_p_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_ul_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_ul_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_ol_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_ol_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_li_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_li_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_br_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_br_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_tr_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_tr_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_font_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_font_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_form_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_form_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_input_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_input_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_center_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_center_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_hr_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_hr_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_img_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_img_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_select_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_select_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_option_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_option_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_div_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_div_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_textarea_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_textarea_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_b_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_b_tag (void *pdoc, Node *node);
+static char *s_jhtml_chxjif_tag (void *pdoc, Node *node);
+static char *s_jhtml_text_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_blockquote_tag(void *pdoc, Node *node);
+static char *s_jhtml_end_blockquote_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_dir_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_dir_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_dl_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_dl_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_dt_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_dt_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_dd_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_dd_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_h1_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_h1_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_h2_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_h2_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_h3_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_h3_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_h4_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_h4_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_h5_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_h5_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_h6_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_h6_tag (void *pdoc, Node *node);
+static char *s_jhtml_start_menu_tag (void *pdoc, Node *node);
+static char *s_jhtml_end_menu_tag (void *pdoc, Node *node);
+
+static void s_init_jhtml(jhtml_t *jhtml, Doc *doc, request_rec *r, device_table *spec);
+
+static int s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt);
+
+static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
},
/* tagH1 */
{
- NULL,
- NULL,
+ s_jhtml_start_h1_tag,
+ s_jhtml_end_h1_tag,
},
/* tagH2 */
{
- NULL,
- NULL,
+ s_jhtml_start_h2_tag,
+ s_jhtml_end_h2_tag,
},
/* tagH3 */
{
- NULL,
- NULL,
+ s_jhtml_start_h3_tag,
+ s_jhtml_end_h3_tag,
},
/* tagH4 */
{
- NULL,
- NULL,
+ s_jhtml_start_h4_tag,
+ s_jhtml_end_h4_tag,
},
/* tagH5 */
{
- NULL,
- NULL,
+ s_jhtml_start_h5_tag,
+ s_jhtml_end_h5_tag,
},
/* tagH6 */
{
- NULL,
- NULL,
+ s_jhtml_start_h6_tag,
+ s_jhtml_end_h6_tag,
},
/* tagHEAD */
{
NULL,
NULL,
},
+ /* tagDT */
+ {
+ s_jhtml_start_dt_tag,
+ s_jhtml_end_dt_tag,
+ },
+ /* tagLEGEND */
+ {
+ NULL,
+ NULL,
+ },
+ /* tagLABEL */
+ {
+ NULL,
+ NULL,
+ },
+ /* tagBLOCKQUOTE */
+ {
+ s_jhtml_start_blockquote_tag,
+ s_jhtml_end_blockquote_tag,
+ },
+ /* tagDIR */
+ {
+ s_jhtml_start_dir_tag,
+ s_jhtml_end_dir_tag,
+ },
+ /* tagDL */
+ {
+ s_jhtml_start_dl_tag,
+ s_jhtml_end_dl_tag,
+ },
+ /* tagDD */
+ {
+ s_jhtml_start_dd_tag,
+ s_jhtml_end_dd_tag,
+ },
+ /* tagMENU */
+ {
+ s_jhtml_start_menu_tag,
+ s_jhtml_end_menu_tag,
+ },
+ /* tagPLAINTEXT */
+ {
+ NULL,
+ NULL,
+ },
+ /* tagBLINK */
+ {
+ NULL,
+ NULL,
+ },
+ /* tagMARQUEE */
+ {
+ NULL,
+ NULL,
+ },
};
*/
char*
chxj_exchange_jhtml(
- request_rec* r,
- device_table* spec,
- const char* src,
+ request_rec *r,
+ device_table *spec,
+ const char *src,
apr_size_t srclen,
- apr_size_t* dstlen,
- chxjconvrule_entry* entryp,
- cookie_t* cookie
+ apr_size_t *dstlen,
+ chxjconvrule_entry *entryp,
+ cookie_t *cookie
)
{
- char* dst;
- char* ss;
+ char *dst;
+ char *ss;
jhtml_t jhtml;
Doc doc;
jhtml.entryp = entryp;
jhtml.cookie = cookie;
- ap_set_content_type(r, "text/html; charset=Windows-31J");
+ chxj_set_content_type(r, "text/html; charset=Windows-31J");
/*--------------------------------------------------------------------------*/
/* The character string of the input is analyzed. */
qs_parse_string(&doc,ss,strlen(ss));
+ chxj_buffered_write_init(r->pool, &doc.buf);
/*--------------------------------------------------------------------------*/
/* It converts it from CHTML to JHTML. */
/*--------------------------------------------------------------------------*/
chxj_node_exchange(spec,r,(void*)&jhtml, &doc, qs_get_root(&doc), 0);
- dst = jhtml.out;
+ jhtml.out = chxj_buffered_write_flush(jhtml.out, &doc.buf);
+ dst = apr_pstrdup(r->pool, jhtml.out);
+ chxj_buffered_write_terminate(&doc.buf);
+
qs_all_free(&doc,QX_LOGMARK);
jhtml->doc = doc;
jhtml->spec = spec;
jhtml->out = qs_alloc_zero_byte_string(r);
- jhtml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+ jhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
jhtml->doc->parse_mode = PARSE_MODE_CHTML;
}
* @return When corresponding EMOJI exists, it returns it excluding 0.
*/
static int
-s_jhtml_search_emoji(jhtml_t* jhtml, char* txt, char** rslt)
+s_jhtml_search_emoji(jhtml_t *jhtml, char *txt, char **rslt)
{
- emoji_t* ee;
- request_rec* r;
- device_table* spec;
+ emoji_t *ee;
+ request_rec *r;
+ device_table *spec;
int len;
spec = jhtml->spec;
* @param node [i] The HTML tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_html_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
jhtml = GET_JHTML(pdoc);
/*--------------------------------------------------------------------------*/
/* start HTML tag */
/*--------------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<html>\n", NULL);
+ W_L("<html>");
DBG(r, "end s_jhtml_start_html_tag()");
* @param node [i] The HTML tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_html_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_html_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</html>\n", NULL);
+ W_L("</html>");
return jhtml->out;
}
* @param node [i] The META tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_meta_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_meta_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
- Attr* attr;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
int content_type_flag;
int refresh_flag;
refresh_flag = 0;
content_type_flag = 0;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<meta", NULL);
-
-
+ W_L("<meta");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
-
- char* name;
- char* value;
-
- name = qs_get_attr_name(doc,attr);
- value = qs_get_attr_value(doc,attr);
-
- if ((*name == 'h' || *name == 'H') && strcasecmp(name, "http-equiv") == 0) {
- /*----------------------------------------------------------------------*/
- /* CHTML 2.0 */
- /*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " http-equiv=\"",
- value,
- "\"",
- NULL);
- if ((*value == 'c' || *value == 'C')
- && strcasecmp(value, "content-type") == 0) {
- content_type_flag = 1;
- }
- if ((*value == 'r' || *value == 'R')
- && strcasecmp(value, "refresh") == 0)
- refresh_flag = 1;
- }
- else
- if ((*name == 'c' || *name == 'C') &&strcasecmp(name, "content") == 0) {
- /*----------------------------------------------------------------------*/
- /* CHTML 2.0 */
- /*----------------------------------------------------------------------*/
- if (content_type_flag) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " ",
- name,
- "=\"",
- "text/html; charset=Windows-31J",
- "\"",
- NULL);
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ switch(*name) {
+ case 'h':
+ case 'H':
+ if (strcasecmp(name, "http-equiv") == 0) {
+ /*----------------------------------------------------------------------*/
+ /* CHTML 2.0 */
+ /*----------------------------------------------------------------------*/
+ W_L(" http-equiv=\"");
+ W_V(value);
+ W_L("\"");
+ if (STRCASEEQ('c','C',"content-type",value)) {
+ content_type_flag = 1;
+ }
+ if (STRCASEEQ('r','R',"refresh",value)) {
+ refresh_flag = 1;
+ }
}
- else
- if (refresh_flag) {
- char* buf;
- char* sec;
- char* url;
-
- buf = apr_pstrdup(r->pool, value);
-
- url = strchr(buf, ';');
- if (url) {
- sec = apr_pstrdup(r->pool, buf);
- sec[url-buf] = 0;
- url++;
- url = chxj_encoding_parameter(r, url);
- url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " ",
- name,
- "=\"",
- sec,
- ";",
- url,
- "\"",
- NULL);
+ break;
+
+ case 'c':
+ case 'C':
+ if (strcasecmp(name, "content") == 0) {
+ /*----------------------------------------------------------------------*/
+ /* CHTML 2.0 */
+ /*----------------------------------------------------------------------*/
+ if (content_type_flag) {
+ W_L(" ");
+ W_V(name);
+ W_L("=\"");
+ W_L("text/html; charset=Windows-31J");
+ W_L("\"");
+ }
+ else
+ if (refresh_flag) {
+ char *buf;
+ char *sec;
+ char *url;
+
+ buf = apr_pstrdup(r->pool, value);
+
+ url = strchr(buf, ';');
+ if (url) {
+ sec = apr_pstrdup(r->pool, buf);
+ sec[url-buf] = 0;
+ url++;
+ url = chxj_encoding_parameter(r, url);
+ url = chxj_add_cookie_parameter(r, url, jhtml->cookie);
+ W_L(" ");
+ W_V(name);
+ W_L("=\"");
+ W_V(sec);
+ W_L(";");
+ W_V(url);
+ W_L("\"");
+ }
+ }
+ else {
+ W_L(" ");
+ W_V(name);
+ W_L("=\"");
+ W_V(value);
+ W_L("\"");
}
}
- else
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " ",
- name,
- "=\"",
- value,
- "\"",
- NULL);
+ break;
+
+ default:
+ break;
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The META tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_meta_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_meta_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml;
-
- jhtml = GET_JHTML(pdoc);
+ jhtml_t *jhtml = GET_JHTML(pdoc);
return jhtml->out;
}
* @param node [i] The HEAD tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_head_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_head_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<head>\r\n", NULL);
-
+ W_L("<head>");
return jhtml->out;
}
* @param node [i] The HEAD tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_head_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_head_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</head>\r\n", NULL);
-
+ W_L("</head>");
return jhtml->out;
}
* @param node [i] The TITLE tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_title_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_title_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<title>", NULL);
-
+ W_L("<title>");
return jhtml->out;
}
* @param node [i] The TITLE tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_title_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_title_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</title>\r\n", NULL);
-
+ W_L("</title>");
return jhtml->out;
}
* @param node [i] The BASE tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_base_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_base_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml;
- Attr* attr;
- Doc* doc;
- request_rec* r;
+ jhtml_t *jhtml;
+ Attr *attr;
+ Doc *doc;
+ request_rec *r;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<base", NULL);
-
+ W_L("<base");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
-
- char* name;
- char* value;
-
- name = qs_get_attr_name(doc,attr);
- value = qs_get_attr_value(doc,attr);
-
- if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " href=\"",
- value,
- "\"",
- NULL);
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('h','H',"href",name)) {
+ W_L(" href=\"");
+ W_V(value);
+ W_L("\"");
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >\r\n", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The BASE tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_base_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_base_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml;
-
- jhtml = GET_JHTML(pdoc);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
return jhtml->out;
}
* @param node [i] The BODY tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_body_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_body_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
- Attr* attr;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<body", NULL);
-
+ W_L("<body");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
-
- char* name;
- char* value;
-
- name = qs_get_attr_name(doc,attr);
- value = qs_get_attr_value(doc,attr);
-
- if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 2.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " bgcolor=\"",
- value,
- "\"",
- NULL);
+ W_L(" bgcolor=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
+ else if (STRCASEEQ('t','T',"text",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 2.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " text=\"",
- value,
- "\"",
- NULL);
+ W_L(" text=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
+ else if (STRCASEEQ('l','L',"link",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 2.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " link=\"",
- value,
- "\"",
- NULL);
+ W_L(" link=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
+ else if (STRCASEEQ('a','A',"alink",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 4.0 */
/*----------------------------------------------------------------------*/
/* ignore */
}
- else
- if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
+ else if (STRCASEEQ('v','V',"vlink",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 4.0 */
/*----------------------------------------------------------------------*/
- /* ignore */
+ W_L(" vlink=\"");
+ W_V(value);
+ W_L("\"");
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\r\n", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The BODY tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_body_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_body_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</body>\r\n", NULL);
-
+ W_L("</body>");
return jhtml->out;
}
* @param node [i] The A tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_a_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_a_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml;
- Doc* doc;
- request_rec* r;
- Attr* attr;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
jhtml = GET_JHTML(pdoc);
doc = jhtml->doc;
r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<a", NULL);
-
+ W_L("<a");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
-
- char* name;
- char* value;
-
- name = qs_get_attr_name(doc,attr);
- value = qs_get_attr_value(doc,attr);
-
- if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('n','N',"name",name)) {
/*----------------------------------------------------------------------*/
/* CHTML1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " name=\"",
- value,
- "\"",
- NULL);
+ W_L(" name=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
+ else if (STRCASEEQ('h','H',"href",name)) {
/*----------------------------------------------------------------------*/
/* CHTML1.0 */
/*----------------------------------------------------------------------*/
value = chxj_encoding_parameter(r, value);
value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " href=\"",
- value,
- "\"",
- NULL);
+ W_L(" href=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
+ else if (STRCASEEQ('a','A',"accesskey",name)) {
/*----------------------------------------------------------------------*/
/* CHTML1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " accesskey=\"",
- value,
- "\"",
- NULL);
+ W_L(" accesskey=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
+ else if (STRCASEEQ('c','C',"cti",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 2.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " cti=\"",
- value,
- "\"",
- NULL);
+ W_L(" cti=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
+ else if (STRCASEEQ('i','I',"ijam",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 3.0 */
/*----------------------------------------------------------------------*/
/* ignore */
}
- else
- if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
+ else if (STRCASEEQ('u','U',"utn",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 3.0 */
/* It is special only for CHTML. */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " utn ",
- NULL);
+ W_L(" utn ");
}
- else
- if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
+ else if (STRCASEEQ('t','T',"telbook",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 3.0 */
/*----------------------------------------------------------------------*/
/* not support */
}
- else
- if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
+ else if (STRCASEEQ('k','K',"kana",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 3.0 */
/*----------------------------------------------------------------------*/
/* not support */
}
- else
- if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
+ else if (STRCASEEQ('e','E',"email",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 3.0 */
/*----------------------------------------------------------------------*/
/* not support */
}
- else
- if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
+ else if (STRCASEEQ('i','I',"ista",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 4.0 */
/*----------------------------------------------------------------------*/
/* ignore */
}
- else
- if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
+ else if (STRCASEEQ('i','I',"ilet",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 5.0 */
/*----------------------------------------------------------------------*/
/* ignore */
}
- else
- if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
+ else if (STRCASEEQ('i','I',"iswf",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 5.0 */
/*----------------------------------------------------------------------*/
/* ignore */
}
- else
- if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
+ else if (STRCASEEQ('i','I',"irst",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 5.0 */
/*----------------------------------------------------------------------*/
/* ignore */
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The A tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_a_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_a_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</a>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("</a>");
return jhtml->out;
}
* @param node [i] The BR tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_br_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_br_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<br>\r\n", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("<br");
+ /*--------------------------------------------------------------------------*/
+ /* Get Attributes */
+ /*--------------------------------------------------------------------------*/
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('c','C',"clear",name)) {
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
+ W_L(" clear=\"");
+ W_V(value);
+ W_L("\"");
+ }
+ }
+ }
+ W_L(">");
return jhtml->out;
}
* @param node [i] The BR tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_br_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
return jhtml->out;
}
* @param node [i] The TR tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_tr_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<br>\r\n", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("<br>\r\n");
return jhtml->out;
}
* @param node [i] The TR tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_tr_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_tr_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
return jhtml->out;
}
* @param node [i] The FONT tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_font_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_font_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- Attr* attr;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<font", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("<font");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* name = qs_get_attr_name(doc,attr);
- char* value = qs_get_attr_value(doc,attr);
-
- if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " color=\"",
- value,
- "\"",
- NULL);
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('c','C',"color",name)) {
+ W_L(" color=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
+ else if (STRCASEEQ('s','S',"size",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 5.0 */
/*----------------------------------------------------------------------*/
/* ignore */
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The FONT tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_font_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_font_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- request_rec* r = jhtml->doc->r;
+ jhtml_t *jhtml;
+ request_rec *r;
+ Doc *doc;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</font>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = jhtml->doc->r;
+ W_L("</font>");
return jhtml->out;
}
* @param node [i] The FORM tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_form_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_form_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- Attr* attr;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ int dcflag = 0;
+ char *dc = NULL;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<form", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("<form");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* name = qs_get_attr_name(doc,attr);
- char* value = qs_get_attr_value(doc,attr);
-
- if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"action",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " action=\"",
- value,
- "\"",
- NULL);
+ W_L(" action=\"");
+ W_V(value);
+ W_L("\"");
+ dc = chxj_add_cookie_parameter(r, value, jhtml->cookie);
+ if (strcmp(dc, value)) {
+ dcflag = 1;
+ }
}
- else
- if ((*name == 'm' || *name == 'M') && strcasecmp(name, "method") == 0) {
+ else if (STRCASEEQ('m','M',"method",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " method=\"",
- value,
- "\"",
- NULL);
+ W_L(" method=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
+ else if (STRCASEEQ('u','U',"utn",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 3.0 */
/* It is special only for CHTML. */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " utn ",
- NULL);
+ /* ignore */
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
-
- if (jhtml->cookie && jhtml->cookie->cookie_id) {
- jhtml->out = apr_psprintf(r->pool, "%s<input type='hidden' name='%s' value='%s'>",
- jhtml->out,
- CHXJ_COOKIE_PARAM,
- jhtml->cookie->cookie_id);
+ W_L(">");
+ /*-------------------------------------------------------------------------*/
+ /* ``action=""'' */
+ /*-------------------------------------------------------------------------*/
+ if (! dc) {
+ dcflag = 1;
+ }
+ /*-------------------------------------------------------------------------*/
+ /* Add cookie parameter */
+ /*-------------------------------------------------------------------------*/
+ if (jhtml->cookie && jhtml->cookie->cookie_id && dcflag == 1) {
+ char *vv = apr_psprintf(doc->buf.pool, "%s<input type='hidden' name='%s' value='%s'>",
+ jhtml->out,
+ CHXJ_COOKIE_PARAM,
+ chxj_url_decode(r, jhtml->cookie->cookie_id));
+ W_V(vv);
}
-
return jhtml->out;
}
* @param node [i] The FORM tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_form_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_form_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</form>", NULL);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</form>");
return jhtml->out;
}
* @param node [i] The INPUT tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_input_tag(void* pdoc, Node* node)
-{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- char* max_length = NULL;
- char* type = NULL;
- char* name = NULL;
- char* value = NULL;
- char* istyle = NULL;
- char* size = NULL;
- char* checked = NULL;
- char* accesskey = NULL;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<input", NULL);
-
+static char *
+s_jhtml_start_input_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ char *max_length;
+ char *type;
+ char *name;
+ char *value;
+ char *istyle;
+ char *size;
+ char *checked;
+ char *accesskey;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ max_length = NULL;
+ type = NULL;
+ name = NULL;
+ value = NULL;
+ istyle = NULL;
+ size = NULL;
+ checked = NULL;
+ accesskey = NULL;
+
+ W_L("<input");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
-
type = qs_get_type_attr(doc, node, r);
name = qs_get_name_attr(doc, node, r);
value = qs_get_value_attr(doc,node,r);
size = qs_get_size_attr(doc, node, r);
if (type) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " type=\"",
- type,
- "\" ",
- NULL);
+ if (type && (STRCASEEQ('t','T',"text", type) ||
+ STRCASEEQ('p','P',"password",type) ||
+ STRCASEEQ('c','C',"checkbox",type) ||
+ STRCASEEQ('r','R',"radio", type) ||
+ STRCASEEQ('h','H',"hidden", type) ||
+ STRCASEEQ('s','S',"submit", type) ||
+ STRCASEEQ('r','R',"reset", type))) {
+ W_L(" type=\"");
+ W_V(type);
+ W_L("\"");
+ }
}
- if (size) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " size=\"",
- size,
- "\" ",
- NULL);
+ if (size && *size) {
+ W_L(" size=\"");
+ W_V(size);
+ W_L("\"");
}
- if (name) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " name=\"",
- name,
- "\" ",
- NULL);
+ if (name && *name) {
+ W_L(" name=\"");
+ W_V(name);
+ W_L("\"");
}
- if (value) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " value=\"",
- value,
- "\" ",
- NULL);
+ if (value && *value) {
+ W_L(" value=\"");
+ W_V(value);
+ W_L("\"");
}
- if (accesskey) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " accesskey=\"",
- accesskey, "\" ",
- NULL);
+ if (accesskey && *accesskey) {
+ W_L(" accesskey=\"");
+ W_V(accesskey);
+ W_L("\"");
}
- if (istyle) {
+ if (istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
/*------------------------------------------------------------------------*/
/* CHTML 2.0 */
/*------------------------------------------------------------------------*/
- if (type && (*type == 'p' || *type == 'P') && strcasecmp(type, "password") == 0
- && ! jhtml->entryp->pc_flag ) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " mode=\"",
- "numeric", "\" ",
- NULL);
+ if (type && STRCASEEQ('p','P',"password", type) && ! jhtml->entryp->pc_flag ) {
+ W_L(" mode=\"");
+ W_L("numeric");
+ W_L("\"");
}
else {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " mode=\"",
- chxj_istyle_to_mode(r,istyle), "\" ",
- NULL);
+ char *vv = chxj_istyle_to_mode(doc->buf.pool,istyle);
+ W_L(" mode=\"");
+ W_V(vv);
+ W_L("\"");
}
}
- else
- if (istyle == NULL && type != NULL && strcasecmp(type, "password") == 0) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " mode=\"",
- "numeric", "\" ",
- NULL);
+ else if (type && STRCASEEQ('p','P',"password",type)) {
+ W_L(" mode=\"");
+ W_L("numeric");
+ W_L("\"");
}
/*--------------------------------------------------------------------------*/
/* The figure is default for the password. */
/*--------------------------------------------------------------------------*/
- if (max_length) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " maxlength=\"",
- max_length,
- "\"",
- NULL);
+ if (max_length && *max_length) {
+ if (chxj_chk_numeric(max_length) == 0) {
+ W_L(" maxlength=\"");
+ W_V(max_length);
+ W_L("\"");
+ }
}
if (checked) {
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " checked ", NULL);
+ W_L(" checked");
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The INPUT tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_input_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_input_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
return jhtml->out;
}
* @param node [i] The CENTER tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_center_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_center_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<center>", NULL);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<center>");
return jhtml->out;
}
* @param node [i] The CENTER tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_center_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_center_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</center>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("</center>");
return jhtml->out;
}
* @param node [i] The li tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_li_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_li_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<li>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
- return jhtml->out;
-}
+ W_L("<li");
+ /*--------------------------------------------------------------------------*/
+ /* Get Attributes */
+ /*--------------------------------------------------------------------------*/
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
+ W_L(" type=\"");
+ W_V(value);
+ W_L("\"");
+ }
+ else if (STRCASEEQ('v','V',"value", name) && value && *value) {
+ W_L(" value=\"");
+ W_V(value);
+ W_L("\"");
+ }
+ }
+ W_L(">");
+ return jhtml->out;
+}
/**
* @param node [i] The li tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_li_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_li_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</li>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("</li>");
return jhtml->out;
}
* @param node [i] The OL tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_ol_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_ol_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ol>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("<ol");
+ /*--------------------------------------------------------------------------*/
+ /* Get Attributes */
+ /*--------------------------------------------------------------------------*/
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
+ W_L(" type=\"");
+ W_V(value);
+ W_L("\"");
+ }
+ else if (STRCASEEQ('s','S',"start",name) && value && *value) {
+ W_L(" start=\"");
+ W_V(value);
+ W_L("\"");
+ }
+ }
+ W_L(">");
return jhtml->out;
}
* @param node [i] The OL tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_ol_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_ol_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ol>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("</ol>");
return jhtml->out;
}
* @param node [i] The P tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_p_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_p_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<p>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("<p>");
return jhtml->out;
}
* @param node [i] The P tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_p_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_p_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</p>", NULL);
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</p>");
return jhtml->out;
}
* @param node [i] The PRE tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_pre_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_pre_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
jhtml->pre_flag++;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<pre>", NULL);
-
+ W_L("<pre>");
return jhtml->out;
}
* @param node [i] The PRE tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_pre_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_pre_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</pre>", NULL);
+ W_L("</pre>");
jhtml->pre_flag--;
return jhtml->out;
* @param node [i] The UL tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_ul_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_ul_tag(void *pdoc, Node *UNUSED(node))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<ul>", NULL);
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<ul>");
return jhtml->out;
}
* @param node [i] The UL tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_ul_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_ul_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</ul>", NULL);
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</ul>");
return jhtml->out;
}
* @param node [i] The HR tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_hr_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_hr_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- Attr* attr;
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ Attr *attr;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<hr ", NULL);
-
+ W_L("<hr");
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* name = qs_get_attr_name(doc,attr);
- char* value = qs_get_attr_value(doc,attr);
- if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " align=\"", value, "\" ", NULL);
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+ W_L(" align=\"");
+ W_V(value);
+ W_L("\"");
+ }
}
- else
- if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
+ else if (STRCASEEQ('s','S',"size",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " size=\"", value, "\" ", NULL);
+ W_L(" size=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width") == 0) {
+ else if (STRCASEEQ('w','W',"width",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " width=\"", value, "\" ", NULL);
+ W_L(" width=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'n' || *name == 'N') && strcasecmp(name, "noshade") == 0) {
+ else if (STRCASEEQ('n','N',"noshade",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out,
- " noshade ", NULL);
+ W_L(" noshade");
}
- else
- if ((*name == 'c' || *name == 'C') && strcasecmp(name, "color") == 0) {
+ else if (STRCASEEQ('c','C',"color",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 4.0 */
/*----------------------------------------------------------------------*/
- /* ignore */
+ W_L(" color=\"");
+ W_V(value);
+ W_L("\"");
}
}
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The HR tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_hr_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_hr_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
return jhtml->out;
}
* @param node [i] The IMG tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_img_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_start_img_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- Attr* attr;
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ request_rec *r = doc->r;
+ Attr *attr;
#ifndef IMG_NOT_CONVERT_FILENAME
- device_table* spec = jhtml->spec;
+ device_table *spec = jhtml->spec;
#endif
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<img", NULL);
-
-
+ W_L("<img");
/*--------------------------------------------------------------------------*/
/* Get Attributes */
/*--------------------------------------------------------------------------*/
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* name = qs_get_attr_name(doc,attr);
- char* value = qs_get_attr_value(doc,attr);
-
- if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
+ char *name = qs_get_attr_name(doc,attr);
+ char *value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('s','S',"src",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
#ifdef IMG_NOT_CONVERT_FILENAME
value = chxj_encoding_parameter(r, value);
value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " src=\"",value,"\"", NULL);
+ if (value) {
+ value = apr_psprintf(r->pool,
+ "%s%c%s=true",
+ value,
+ (strchr(value, '?')) ? '&' : '?',
+ CHXJ_COOKIE_NOUPDATE_PARAM);
+ }
+ W_L(" src=\"");
+ W_V(value);
+ W_L("\"");
#else
value = chxj_img_conv(r, spec, value);
value = chxj_encoding_parameter(r, value);
value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " src=\"", value, NULL);
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "\"", NULL);
+ if (value) {
+ value = apr_psprintf(r->pool,
+ "%s%c%s=true",
+ value,
+ (strchr(value, '?')) ? '&' : '?',
+ CHXJ_COOKIE_NOUPDATE_PARAM);
+ }
+ W_L(" src=\"");
+ W_V(value);
+ W_L("\"");
#endif
}
- else
- if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
+ else if (STRCASEEQ('a','A',"align",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " align=\"",value,"\"", NULL);
+ if (value && (STRCASEEQ('t','T',"top", value) ||
+ STRCASEEQ('m','M',"middle",value) ||
+ STRCASEEQ('b','B',"bottom",value) ||
+ STRCASEEQ('l','L',"left", value) ||
+ STRCASEEQ('r','R',"right", value))) {
+ W_L(" align=\"");
+ W_V(value);
+ W_L("\"");
+ }
}
- else
- if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
+ else if (STRCASEEQ('w','W',"width",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " width=\"",value,"\"", NULL);
+ W_L(" width=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
+ else if (STRCASEEQ('h','H',"height",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " height=\"",value,"\"", NULL);
+ W_L(" height=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
+ else if (STRCASEEQ('h','H',"hspace",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " hspace=\"",value,"\"", NULL);
+ /* ignore */
}
- else
- if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
+ else if (STRCASEEQ('v','V',"vspace",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " vspace=\"",value,"\"", NULL);
+ /* ignore */
}
- else
- if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
+ else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " alt=\"",value,"\"", NULL);
- }
- else
- if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
- /*----------------------------------------------------------------------*/
- /* CHTML 4.0 */
- /*----------------------------------------------------------------------*/
- /* ignore */
+ W_L(" alt=\"");
+ W_V(value);
+ W_L("\"");
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
-
+ W_L(">");
return jhtml->out;
}
* @param node [i] The IMG tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_img_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_img_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
return jhtml->out;
}
* @param node [i] The SELECT tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_select_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_start_select_tag(void *pdoc, Node *child)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- Attr* attr;
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ Attr *attr;
- char* size = NULL;
- char* name = NULL;
+ char *size = NULL;
+ char *name = NULL;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<select", NULL);
+ W_L("<select");
for (attr = qs_get_attr(doc,child);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* nm = qs_get_attr_name(doc,attr);
- char* val = qs_get_attr_value(doc,attr);
-
- if ((*name == 's' || *name == 'S') && strcasecmp(nm, "size") == 0) {
+ char *nm = qs_get_attr_name(doc,attr);
+ char *val = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('s','S',"size",nm)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 version 2.0 */
/*----------------------------------------------------------------------*/
- size = apr_pstrdup(r->pool, val);
+ size = apr_pstrdup(doc->buf.pool, val);
}
- else
- if ((*name == 'n' || *name == 'N') && strcasecmp(nm, "name") == 0) {
+ else if (STRCASEEQ('n','N',"name",nm)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 version 2.0 */
/*----------------------------------------------------------------------*/
- name = apr_pstrdup(r->pool, val);
+ name = apr_pstrdup(doc->buf.pool, val);
}
- else
- if ((*name == 'm' || *name == 'M') && strcasecmp(nm, "multiple") == 0) {
+ else if (STRCASEEQ('m','M',"multiple",nm)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 version 2.0 */
/*----------------------------------------------------------------------*/
}
}
- if (size)
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " size=\"",size,"\"", NULL);
-
- if (name)
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",name,"\"", NULL);
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\n", NULL);
+ if (size) {
+ W_L(" size=\"");
+ W_V(size);
+ W_L("\"");
+ }
+ if (name) {
+ W_L(" name=\"");
+ W_V(name);
+ W_L("\"");
+ }
+ W_L(">");
return jhtml->out;
}
* @param node [i] The SELECT tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_select_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_select_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</select>\n", NULL);
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</select>");
return jhtml->out;
}
* @param node [i] The OPTION tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_option_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_start_option_tag(void *pdoc, Node *child)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- Attr* attr;
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ Attr *attr;
- char* selected = NULL;
- char* value = NULL;
+ char *selected = NULL;
+ char *value = NULL;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<option", NULL);
+ W_L("<option");
for (attr = qs_get_attr(doc,child);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* nm = qs_get_attr_name(doc,attr);
- char* val = qs_get_attr_value(doc,attr);
-
- if ((*nm == 's' || *nm == 'S') && strcasecmp(nm, "selected") == 0) {
+ char *nm = qs_get_attr_name(doc,attr);
+ char *val = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('s','S',"selected",nm)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 version 2.0 */
/*----------------------------------------------------------------------*/
- selected = apr_pstrdup(r->pool, val);
+ selected = apr_pstrdup(doc->buf.pool, val);
}
- else
- if ((*nm == 'v' || *nm == 'V') && strcasecmp(nm, "value") == 0) {
+ else if (STRCASEEQ('v','V',"value",nm)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 version 2.0 */
/*----------------------------------------------------------------------*/
- value = apr_pstrdup(r->pool, val);
+ value = apr_pstrdup(doc->buf.pool, val);
}
}
- if (value)
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"",value,"\"", NULL);
- else
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"\"", NULL);
-
- if (selected)
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " selected ", NULL);
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+ if (value) {
+ W_L(" value=\"");
+ W_V(value);
+ W_L("\"");
+ }
+ else {
+ W_L(" value=\"\"");
+ }
+ if (selected) {
+ W_L(" selected ");
+ }
+ W_L(">");
return jhtml->out;
}
* @param node [i] The OPTION tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_option_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_option_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
-
+ jhtml_t *jhtml = GET_JHTML(pdoc);
/* Don't close */
-
return jhtml->out;
}
* @param node [i] The DIV tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_start_div_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_start_div_tag(void *pdoc, Node *child)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
- Attr* attr;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ char *align = NULL;
- char* align = NULL;
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<div", NULL);
+ W_L("<div");
for (attr = qs_get_attr(doc,child);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* nm = qs_get_attr_name(doc,attr);
- char* val = qs_get_attr_value(doc,attr);
-
- if ((*nm == 'a' || *nm == 'A') && strcasecmp(nm, "align") == 0) {
+ char *nm = qs_get_attr_name(doc,attr);
+ char *val = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align",nm)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 (W3C version 3.2) */
/*----------------------------------------------------------------------*/
- align = apr_pstrdup(r->pool, val);
+ if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
+ align = apr_pstrdup(doc->buf.pool, val);
+ }
}
}
-
- if (align)
- jhtml->out = apr_pstrcat(r->pool,
- jhtml->out, " align=\"", align, "\"", NULL);
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
-
+ if (align) {
+ W_L(" align=\"");
+ W_V(align);
+ W_L("\"");
+ }
+ W_L(">");
return jhtml->out;
}
* @param node [i] The DIV tag node is specified.
* @return The conversion result is returned.
*/
-static char*
-s_jhtml_end_div_tag(void* pdoc, Node* child)
+static char *
+s_jhtml_end_div_tag(void *pdoc, Node *UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</div>\n", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("</div>");
return jhtml->out;
}
-static char*
-chxj_istyle_to_mode(request_rec* r, const char* s)
+static char *
+chxj_istyle_to_mode(apr_pool_t *p, const char *s)
{
- char* tmp;
+ char *tmp;
if (s) {
switch (s[0]) {
- case '1': return apr_psprintf(r->pool, "hiragana");
- case '2': return apr_psprintf(r->pool, "hankakukana");
- case '3': return apr_psprintf(r->pool, "alphabet");
- case '4': return apr_psprintf(r->pool, "numeric");
+ case '1': return apr_psprintf(p, "hiragana");
+ case '2': return apr_psprintf(p, "hankakukana");
+ case '3': return apr_psprintf(p, "alphabet");
+ case '4': return apr_psprintf(p, "numeric");
default:
- tmp = apr_palloc(r->pool, 1);
+ tmp = apr_palloc(p, 1);
tmp[0] = '\0';
- return apr_pstrdup(r->pool, tmp);
+ return apr_pstrdup(p, tmp);
}
}
- tmp = apr_palloc(r->pool, 1);
+ tmp = apr_palloc(p, 1);
tmp[0] = '\0';
- return apr_pstrdup(r->pool,tmp);
+ return apr_pstrdup(p,tmp);
}
-static char*
-s_jhtml_chxjif_tag(void* pdoc, Node* node)
+static char *
+s_jhtml_chxjif_tag(void *pdoc, Node *node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- Node* child;
- request_rec* r = doc->r;
+ jhtml_t *jhtml;
+ Doc *doc;
+ Node *child;
+ request_rec *r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
for (child = qs_get_child_node(doc, node);
child;
child = qs_get_next_node(doc, child)) {
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, child->otext, NULL);
+ W_V(child->otext);
s_jhtml_chxjif_tag(jhtml, child);
}
return NULL;
static char*
s_jhtml_start_textarea_tag(void* pdoc, Node* node)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
Attr* attr;
- jhtml->textarea_flag++;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<textarea ", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ jhtml->textarea_flag++;
+ W_L("<textarea ");
for (attr = qs_get_attr(doc,node);
attr;
attr = qs_get_next_attr(doc,attr)) {
- char* name = qs_get_attr_name(doc,attr);
- char* value = qs_get_attr_value(doc,attr);
+ char* name;
+ char* value;
+
+ name = qs_get_attr_name(doc,attr);
+ value = qs_get_attr_value(doc,attr);
- if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",value,"\"", NULL);
+ if (STRCASEEQ('n','N',"name",name)) {
+ W_L(" name=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'r' || *name == 'R') && strcasecmp(name, "rows") == 0) {
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " rows=\"",value,"\"", NULL);
+ else if (STRCASEEQ('r','R',"rows",name)) {
+ W_L(" rows=\"");
+ W_V(value);
+ W_L("\"");
}
- else
- if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cols") == 0) {
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, " cols=\"",value,"\"", NULL);
+ else if (STRCASEEQ('c','C',"cols",name)) {
+ W_L(" cols=\"");
+ W_V(value);
+ W_L("\"");
}
}
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\r\n", NULL);
-
+ W_L(">\r\n");
return jhtml->out;
}
* @return The conversion result is returned.
*/
static char*
-s_jhtml_end_textarea_tag(void* pdoc, Node* child)
+s_jhtml_end_textarea_tag(void* pdoc, Node* UNUSED(child))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</textarea>\r\n", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ W_L("</textarea>\r\n");
jhtml->textarea_flag--;
return jhtml->out;
}
+
/**
* It is a handler who processes the B tag.
*
* @return The conversion result is returned.
*/
static char*
-s_jhtml_start_b_tag(void* pdoc, Node* node)
+s_jhtml_start_b_tag(void* pdoc, Node* UNUSED(node))
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<b>", NULL);
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+ W_L("<b>");
return jhtml->out;
}
* @return The conversion result is returned.
*/
static char*
-s_jhtml_end_b_tag(void* pdoc, Node* child)
+s_jhtml_end_b_tag(void* pdoc, Node* UNUSED(child))
{
jhtml_t* jhtml = GET_JHTML(pdoc);
Doc* doc = jhtml->doc;
- request_rec* r = doc->r;
-
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</b>\r\n", NULL);
+ W_L("</b>\r\n");
return jhtml->out;
}
static char*
s_jhtml_text_tag(void* pdoc, Node* child)
{
- jhtml_t* jhtml = GET_JHTML(pdoc);
- Doc* doc = jhtml->doc;
+ jhtml_t* jhtml;
+ Doc* doc;
char* textval;
char* tmp;
char* tdst;
char one_byte[2];
int ii;
int tdst_len;
- request_rec* r = doc->r;
+ request_rec* r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
textval = qs_get_node_value(doc,child);
- textval = qs_trim_string(jhtml->doc->r, textval);
+ textval = qs_trim_string(doc->buf.pool, textval);
if (strlen(textval) == 0)
return jhtml->out;
}
}
}
- jhtml->out = apr_pstrcat(r->pool, jhtml->out, tdst, NULL);
+ W_V(tdst);
+ return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the BLOCKQUOTE tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The BLOCKQUOTE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<blockquote>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the BLOCKQUOTE tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The BLOCKQUOTE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</blockquote>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DIR tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DIR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_dir_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<dir>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DIR tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DIR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_dir_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</dir>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DL tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DL tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_dl_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<dl>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DL tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DL tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_dl_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</dl>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DT tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_dt_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<dt>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DT tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_dt_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DD tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_dd_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<dd>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DD tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The DD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_dd_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H1 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_h1_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ char *align = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char* name;
+ char* value;
+ name = qs_get_attr_name(doc,attr);
+ value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align", name)) {
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+ jhtml->h1_align_flag++;
+ align = apr_pstrdup(doc->buf.pool, value);
+ break;
+ }
+ }
+ }
+ if (align) {
+ W_L("<div align=\"");
+ W_V(align);
+ W_L("\">");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H1 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ if (jhtml->h1_align_flag) {
+ jhtml->h1_align_flag--;
+ W_L("</div>");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H2 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_h2_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ char *align = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char* name;
+ char* value;
+ name = qs_get_attr_name(doc,attr);
+ value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align", name)) {
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+ jhtml->h2_align_flag++;
+ align = apr_pstrdup(doc->buf.pool, value);
+ break;
+ }
+ }
+ }
+ if (align) {
+ W_L("<div align=\"");
+ W_V(align);
+ W_L("\">");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H2 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ if (jhtml->h2_align_flag) {
+ jhtml->h2_align_flag--;
+ W_L("</div>");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H3 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_h3_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ char *align = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char* name;
+ char* value;
+ name = qs_get_attr_name(doc,attr);
+ value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align", name)) {
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+ jhtml->h3_align_flag++;
+ align = apr_pstrdup(doc->buf.pool, value);
+ break;
+ }
+ }
+ }
+ if (align) {
+ W_L("<div align=\"");
+ W_V(align);
+ W_L("\">");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H3 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ if (jhtml->h3_align_flag) {
+ jhtml->h3_align_flag--;
+ W_L("</div>");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H4 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_h4_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ char *align = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char* name;
+ char* value;
+ name = qs_get_attr_name(doc,attr);
+ value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align", name)) {
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+ jhtml->h4_align_flag++;
+ align = apr_pstrdup(doc->buf.pool, value);
+ break;
+ }
+ }
+ }
+ if (align) {
+ W_L("<div align=\"");
+ W_V(align);
+ W_L("\">");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H4 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ if (jhtml->h4_align_flag) {
+ jhtml->h4_align_flag--;
+ W_L("</div>");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H5 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_h5_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ char *align = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char* name;
+ char* value;
+ name = qs_get_attr_name(doc,attr);
+ value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align", name)) {
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+ jhtml->h5_align_flag++;
+ align = apr_pstrdup(doc->buf.pool, value);
+ break;
+ }
+ }
+ }
+ if (align) {
+ W_L("<div align=\"");
+ W_V(align);
+ W_L("\">");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H5 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ if (jhtml->h5_align_flag) {
+ jhtml->h5_align_flag--;
+ W_L("</div>");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H6 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_h6_tag(void *pdoc, Node *node)
+{
+ jhtml_t *jhtml;
+ Doc *doc;
+ request_rec *r;
+ Attr *attr;
+ char *align = NULL;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ for (attr = qs_get_attr(doc,node);
+ attr;
+ attr = qs_get_next_attr(doc,attr)) {
+ char* name;
+ char* value;
+ name = qs_get_attr_name(doc,attr);
+ value = qs_get_attr_value(doc,attr);
+ if (STRCASEEQ('a','A',"align", name)) {
+ if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+ jhtml->h6_align_flag++;
+ align = apr_pstrdup(doc->buf.pool, value);
+ break;
+ }
+ }
+ }
+ if (align) {
+ W_L("<div align=\"");
+ W_V(align);
+ W_L("\">");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the H6 tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The H1 tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t* jhtml;
+ Doc* doc;
+ request_rec* r;
+
+ jhtml = GET_JHTML(pdoc);
+ doc = jhtml->doc;
+ r = doc->r;
+
+ if (jhtml->h6_align_flag) {
+ jhtml->h6_align_flag--;
+ W_L("</div>");
+ }
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the MENU tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The MENU tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_start_menu_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("<menu>");
+ return jhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the MENU tag.
+ *
+ * @param pdoc [i/o] The pointer to the JHTML structure at the output
+ * destination is specified.
+ * @param node [i] The MENU tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jhtml_end_menu_tag(void *pdoc, Node *UNUSED(child))
+{
+ jhtml_t *jhtml = GET_JHTML(pdoc);
+ Doc *doc = jhtml->doc;
+ W_L("</menu>");
return jhtml->out;
}
/*