OSDN Git Service

* cast from pointer to integer of different size
[modchxj/mod_chxj.git] / src / chxj_xhtml_mobile_1_0.c
index 49e146e..07bb1a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
+ * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,6 +23,7 @@
 #include "chxj_qr_code.h"
 #include "chxj_buffered_write.h"
 #include "chxj_str_util.h"
+#include "chxj_header_inf.h"
 
 #define GET_XHTML(X) ((xhtml_t*)(X))
 #undef W_L
@@ -115,6 +116,7 @@ static char *s_xhtml_1_0_start_blink_tag     (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_blink_tag       (void *pdoc, Node *node);
 static char *s_xhtml_1_0_start_marquee_tag   (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_marquee_tag     (void *pdoc, Node *node);
+static char *s_xhtml_1_0_newline_mark       (void *pdoc, Node *node);
 
 static void  s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
 static int   s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
@@ -387,6 +389,11 @@ tag_handler xhtml_handler[] = {
     s_xhtml_1_0_start_marquee_tag,
     s_xhtml_1_0_end_marquee_tag,
   },
+  /* tagNLMARK */
+  {
+    s_xhtml_1_0_newline_mark,
+    NULL,
+  },
 };
  
 /**
@@ -406,7 +413,7 @@ chxj_convert_xhtml_mobile_1_0(
   apr_size_t         srclen,
   apr_size_t         *dstlen,
   chxjconvrule_entry *entryp,
-  cookie_t           *UNUSED(cookie)
+  cookie_t           *cookie
 )
 {
   char      *dst = NULL;
@@ -431,8 +438,9 @@ chxj_convert_xhtml_mobile_1_0(
   s_init_xhtml(&xhtml, &doc, r, spec);
 
   xhtml.entryp = entryp;
+  xhtml.cookie = cookie;
 
-  chxj_set_content_type(r, "text/html; charset=Windows-31J");
+  chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
 
   /*--------------------------------------------------------------------------*/
   /* The character string of the input is analyzed.                           */
@@ -497,7 +505,7 @@ s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
   doc->r      = r;
   xhtml->doc  = doc;
   xhtml->spec = spec;
-  xhtml->out  = qs_alloc_zero_byte_string(r);
+  xhtml->out  = qs_alloc_zero_byte_string(r->pool);
   xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   xhtml->doc->parse_mode = PARSE_MODE_CHTML;
 }
@@ -638,6 +646,67 @@ s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
 }
 
 
+char *
+chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
+{
+  apr_size_t ii;
+  Doc __doc;
+  Doc *doc;
+  xhtml_t __xhtml;
+  xhtml_t *xhtml;
+  char one_byte[2];
+  char two_byte[3];
+  apr_pool_t *pool;
+
+  xhtml = &__xhtml;
+  doc   = &__doc;
+
+  DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
+  memset(doc,     0, sizeof(Doc));
+  memset(xhtml, 0, sizeof(xhtml_t));
+
+  doc->r        = r;
+  xhtml->doc  = doc;
+  xhtml->spec = spec;
+  xhtml->out  = qs_alloc_zero_byte_string(r->pool);
+  xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
+  xhtml->doc->parse_mode = PARSE_MODE_CHTML;
+
+  apr_pool_create(&pool, r->pool);
+
+  chxj_buffered_write_init(pool, &doc->buf);
+
+  for (ii=0; ii<len; ii++) {
+    char *out;
+    int   rtn;
+
+    rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
+    if (rtn) {
+      W_V(out);
+      ii+=(rtn - 1);
+      continue;
+    }
+
+    if (is_sjis_kanji(src[ii])) {
+      two_byte[0] = src[ii+0];
+      two_byte[1] = src[ii+1];
+      two_byte[2] = 0;
+      W_V(two_byte);
+      ii++;
+    }
+    else {
+      one_byte[0] = src[ii+0];
+      one_byte[1] = 0;
+      W_V(one_byte);
+    }
+  }
+  xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
+
+  DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
+  return xhtml->out;
+}
+
+
 /**
  * It is a handler who processes the HTML tag.
  *
@@ -687,7 +756,6 @@ s_xhtml_1_0_start_html_tag(void *pdoc, Node *node)
     }
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -706,7 +774,6 @@ s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t       *xhtml = GET_XHTML(pdoc);
   Doc           *doc   = xhtml->doc;
   W_L("</html>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -726,6 +793,7 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
   Attr          *attr;
   Doc           *doc   = xhtml->doc;
   int           content_type_flag = 0;
+  request_rec   *r = doc->r;
 
   W_L("<meta");
   /*--------------------------------------------------------------------------*/
@@ -758,7 +826,7 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
         W_L(" ");
         W_V(name);
         W_L("=\"");
-        W_L("text/html; charset=Windows-31J");
+        W_V(chxj_header_inf_set_content_type(r, "text/html; charset=Windows-31J"));
         W_L("\"");
       }
       else {
@@ -771,7 +839,6 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
     }
   }
   W_L(" />");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -808,7 +875,6 @@ s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node))
   Doc           *doc   = xhtml->doc;
 
   W_L("<head>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -828,7 +894,6 @@ s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child))
   Doc           *doc   = xhtml->doc;
 
   W_L("</head>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -867,7 +932,6 @@ s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child))
   Doc           *doc   = xhtml->doc;
 
   W_L("</title>");
-  W_NLCODE();
 
   return xhtml->out;
 }
@@ -905,7 +969,6 @@ s_xhtml_1_0_start_base_tag(void *pdoc, Node *node)
     }
   }
   W_L(" />");
-  W_NLCODE();
 
   return xhtml->out;
 }
@@ -975,7 +1038,6 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
     }
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -995,7 +1057,6 @@ s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
   Doc           *doc   = xhtml->doc;
 
   W_L("</body>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1032,6 +1093,9 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
     }
     else if (STRCASEEQ('h','H',"href", name) && value && *value) {
       value = chxj_encoding_parameter(r, value);
+      if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
+        value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
+      }
       W_L(" href=\"");
       W_V(value);
       W_L("\"");
@@ -1092,7 +1156,6 @@ s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</a>");
-  W_NLCODE();
 
   return xhtml->out;
 }
@@ -1131,7 +1194,6 @@ s_xhtml_1_0_start_br_tag(void *pdoc, Node *node)
     }
   }
   W_L(" />");
-  W_NLCODE();
 
   return xhtml->out;
 }
@@ -1169,7 +1231,6 @@ s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node))
   Doc     *doc   = xhtml->doc;
 
   W_L("<br />");
-  W_NLCODE();
 
   return xhtml->out;
 }
@@ -1301,7 +1362,6 @@ s_xhtml_1_0_end_font_tag(void *pdoc, Node *UNUSED(child))
   }
   if (xhtml->font_color_flag) {
     W_L("</font>");
-    W_NLCODE();
     xhtml->font_color_flag--;
   }
   return xhtml->out;
@@ -1323,8 +1383,11 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
   Doc         *doc   = xhtml->doc;
   request_rec *r     = doc->r;
   Attr        *attr;
+  char        *new_hidden_tag = NULL;
+  char        *attr_action = NULL;
+  char        *attr_method = NULL;
+  char        *attr_name = NULL;
 
-  W_L("<form");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -1334,22 +1397,55 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
     char *name = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"action",name)) {
-      value = chxj_encoding_parameter(r, value);
-      W_L(" action=\"");
-      W_V(value);
-      W_L("\"");
+      attr_action = chxj_encoding_parameter(r, value);
+      attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
     }
     else if (STRCASEEQ('m','M',"method",name)) {
-      W_L(" method=\"");
-      W_V(value);
-      W_L("\"");
+      attr_method = apr_pstrdup(doc->pool, value);
     }
     else if (STRCASEEQ('u','U',"utn",name)) {
       /* ignore */
     }
+    else if (STRCASEEQ('n','N',"name",name)) {
+      attr_name = apr_pstrdup(doc->pool, value);
+    }
+  }
+
+  int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
+
+  W_L("<form");
+  if (attr_action) {
+    char *q;
+    char *old_qs = NULL;
+    q = strchr(attr_action, '?');
+    if (q) {
+      new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_FALSE, xhtml->entryp);
+      if (new_hidden_tag || old_qs) {
+        *q = 0;
+      }
+    }
+    W_L(" action=\"");
+    W_V(attr_action);
+    if (old_qs) {
+      W_L("?");
+      W_V(old_qs);
+    }
+    W_L("\"");
+  }
+  if (attr_method) {
+    W_L(" method=\"");
+    W_V(attr_method);
+    W_L("\"");
+  }
+  if (attr_name) {
+    W_L(" name=\"");
+    W_V(attr_name);
+    W_L("\"");
   }
   W_L(">");
-  W_NLCODE();
+  if (new_hidden_tag) {
+    W_V(new_hidden_tag);
+  }
   return xhtml->out;
 }
 
@@ -1369,7 +1465,6 @@ s_xhtml_1_0_end_form_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</form>");
-  W_NLCODE();
 
   return xhtml->out;
 }
@@ -1402,14 +1497,14 @@ s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
   /*--------------------------------------------------------------------------*/
   /* 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,doc->buf.pool);
-  istyle     = qs_get_istyle_attr(doc,node,r);
-  max_length = qs_get_maxlength_attr(doc,node,r);
-  checked    = qs_get_checked_attr(doc,node,r);
-  accesskey  = qs_get_accesskey_attr(doc, node, r);
-  size       = qs_get_size_attr(doc, node, r);
+  type       = qs_get_type_attr(doc, node, doc->buf.pool);
+  name       = qs_get_name_attr(doc, node, doc->buf.pool);
+  value      = qs_get_value_attr(doc,node, doc->buf.pool);
+  istyle     = qs_get_istyle_attr(doc,node,doc->buf.pool);
+  max_length = qs_get_maxlength_attr(doc,node,doc->buf.pool);
+  checked    = qs_get_checked_attr(doc,node, doc->buf.pool);
+  accesskey  = qs_get_accesskey_attr(doc, node, doc->buf.pool);
+  size       = qs_get_size_attr(doc, node, doc->buf.pool);
 
   if (type) {
     type = qs_trim_string(doc->buf.pool, type);
@@ -1437,7 +1532,7 @@ s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
   }
   if (value && *value) {
     W_L(" value=\"");
-    W_V(value);
+    W_V(chxj_add_slash_to_doublequote(doc->pool, value));
     W_L("\"");
   }
   if (accesskey && *accesskey) {
@@ -1496,7 +1591,6 @@ s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
     W_L(" checked=\"checked\"");
   }
   W_L(" />");
-  W_NLCODE();
 
   return xhtml->out;
 }
@@ -1534,7 +1628,6 @@ s_xhtml_1_0_start_center_tag(void *pdoc, Node *UNUSED(node))
   Doc     *doc   = xhtml->doc;
 
   W_L("<center>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1554,7 +1647,6 @@ s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</center>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1627,7 +1719,6 @@ s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
     }
   }
   W_L(" />");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1665,7 +1756,6 @@ s_xhtml_1_0_start_pre_tag(void* pdoc, Node* UNUSED(node))
 
   xhtml->pre_flag++;
   W_L("<pre>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1685,7 +1775,6 @@ s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</pre>");
-  W_NLCODE();
   xhtml->pre_flag--;
 
   return xhtml->out;
@@ -1730,7 +1819,6 @@ s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1750,7 +1838,6 @@ s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</p>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1787,7 +1874,6 @@ s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
     }
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1807,7 +1893,6 @@ s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</ul>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1876,7 +1961,6 @@ s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h1>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -1945,7 +2029,6 @@ s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h2>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2014,7 +2097,6 @@ s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h3>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2083,7 +2165,6 @@ s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h4>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2152,7 +2233,6 @@ s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h5>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2221,7 +2301,6 @@ s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h6>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2262,7 +2341,6 @@ s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
     }
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2282,7 +2360,6 @@ s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</ol>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2344,7 +2421,6 @@ s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</li>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2380,6 +2456,8 @@ s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
 
     if (STRCASEEQ('s','S',"src",name)) {
       value = chxj_encoding_parameter(r, value);
+      value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
+      value = chxj_add_cookie_no_update_parameter(r, value);
 #ifdef IMG_NOT_CONVERT_FILENAME
 
       W_L(" src=\"");
@@ -2443,7 +2521,6 @@ s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
     }
   }
   W_L(" />");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2524,7 +2601,6 @@ s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
     W_L(" multiple=\"true\"");
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2544,7 +2620,6 @@ s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</select>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2582,7 +2657,7 @@ s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
       value = apr_pstrdup(doc->buf.pool, val);
     }
   }
-  if (value && *value) {
+  if (value) {
     W_L(" value=\"");
     W_V(value);
     W_L("\"");
@@ -2610,7 +2685,6 @@ s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</option>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2652,7 +2726,6 @@ s_xhtml_1_0_start_div_tag(void *pdoc, Node *child)
     W_L("\"");
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2671,7 +2744,6 @@ s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   W_L("</div>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2710,7 +2782,6 @@ s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</div>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2809,7 +2880,6 @@ s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</textarea>");
-  W_NLCODE();
   xhtml->textarea_flag--;
 
   return xhtml->out;
@@ -2836,7 +2906,7 @@ s_xhtml_1_0_text_tag(void *pdoc, Node *child)
   tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
   memset(tmp, 0, qs_get_node_size(doc,child)+1);
   
-  tdst     = qs_alloc_zero_byte_string(r);
+  tdst     = qs_alloc_zero_byte_string(doc->buf.pool);
   memset(one_byte, 0, sizeof(one_byte));
   tdst_len = 0;
   
@@ -2888,7 +2958,6 @@ s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   W_L("<blockquote>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2907,7 +2976,6 @@ s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   W_L("</blockquote>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2941,7 +3009,6 @@ s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
     }
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2960,7 +3027,6 @@ s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc = xhtml->doc;
   W_L("</dir>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2979,7 +3045,6 @@ s_xhtml_1_0_start_dl_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc *doc = xhtml->doc;
   W_L("<dl>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -2998,7 +3063,6 @@ s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc *doc = xhtml->doc;
   W_L("</dl>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -3107,7 +3171,6 @@ s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
     }
   }
   W_L(">");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -3126,7 +3189,6 @@ s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc *doc = xhtml->doc;
   W_L("</menu>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -3215,7 +3277,6 @@ s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc = xhtml->doc;
   W_L("</blink>");
-  W_NLCODE();
   return xhtml->out;
 }
 
@@ -3291,6 +3352,18 @@ s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc = xhtml->doc;
   W_L("</marquee>");
+  return xhtml->out;
+}
+
+
+/**
+ * It is handler who processes the New Line Code.
+ */
+static char *
+s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc *doc = xhtml->doc;
   W_NLCODE();
   return xhtml->out;
 }