OSDN Git Service

* The pre tag and p tag are added to JHTML.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Fri, 16 Jun 2006 00:31:22 +0000 (00:31 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Fri, 16 Jun 2006 00:31:22 +0000 (00:31 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@692 1a406e8e-add9-4483-a2c8-d8cac5b7c224

include/chxj_jhtml.h
src/chxj_jhtml.c
src/mod_chxj.c

index b15bd8a..1a27b1d 100644 (file)
@@ -26,6 +26,7 @@ typedef struct _jhtml_t {
     Doc* doc;
     char* out;
     int   out_len;
+    int   pre_flag;
 
     device_table_t* spec;
     mod_chxj_config* conf;
index 38a9dbb..0cf9f63 100644 (file)
@@ -35,6 +35,10 @@ static char* s_jhtml_start_body_tag   (jhtml_t* jhtml, Node* node);
 static char* s_jhtml_end_body_tag     (jhtml_t* jhtml, Node* node);
 static char* s_jhtml_start_a_tag      (jhtml_t* jhtml, Node* node);
 static char* s_jhtml_end_a_tag        (jhtml_t* jhtml, Node* node);
+static char* s_jhtml_start_pre_tag    (jhtml_t* jhtml, Node* node);
+static char* s_jhtml_end_pre_tag      (jhtml_t* jhtml, Node* node);
+static char* s_jhtml_start_p_tag      (jhtml_t* jhtml, Node* node);
+static char* s_jhtml_end_p_tag        (jhtml_t* jhtml, Node* node);
 static char* s_jhtml_start_ul_tag     (jhtml_t* jhtml, Node* node);
 static char* s_jhtml_end_ul_tag       (jhtml_t* jhtml, Node* node);
 static char* s_jhtml_start_ol_tag     (jhtml_t* jhtml, Node* node);
@@ -194,6 +198,24 @@ s_jhtml_node_exchange(jhtml_t* jhtml, Node* node, int indent)
     char* name = qs_get_node_name(doc,child);
 
     /*------------------------------------------------------------------------*/
+    /* <PRE> (for TEST)                                                       */
+    /*------------------------------------------------------------------------*/
+    if ((*name == 'p' || *name == 'P') && strcasecmp(name, "pre") == 0) {
+      s_jhtml_start_pre_tag (jhtml, child);
+      s_jhtml_node_exchange (jhtml, child, indent+1);
+      s_jhtml_end_pre_tag   (jhtml, child);
+    }
+    else
+    /*------------------------------------------------------------------------*/
+    /* <P> (for TEST)                                                         */
+    /*------------------------------------------------------------------------*/
+    if ((*name == 'p' || *name == 'P') && strcasecmp(name, "p") == 0) {
+      s_jhtml_start_p_tag  (jhtml, child);
+      s_jhtml_node_exchange (jhtml, child, indent+1);
+      s_jhtml_end_p_tag    (jhtml, child);
+    }
+    else
+    /*------------------------------------------------------------------------*/
     /* <UL> (for TEST)                                                        */
     /*------------------------------------------------------------------------*/
     if ((*name == 'u' || *name == 'U') && strcasecmp(name, "ul") == 0) {
@@ -551,10 +573,16 @@ s_jhtml_node_exchange(jhtml_t* jhtml, Node* node, int indent)
             ii++;
           }
           else 
-          if (textval[ii] != '\r' && textval[ii] != '\n') {
+          if (jhtml->pre_flag) {
             one_byte[0] = textval[ii+0];
             tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
           }
+          else {
+            if (textval[ii] != '\r' && textval[ii] != '\n') {
+              one_byte[0] = textval[ii+0];
+              tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+            }
+          }
         }
         jhtml->out = apr_pstrcat(r->pool, jhtml->out, tdst, NULL);
       }
@@ -1623,6 +1651,84 @@ s_jhtml_end_ol_tag(jhtml_t* jhtml, Node* child)
 }
 
 /**
+ * It is a handler who processes the P tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The P tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+s_jhtml_start_p_tag(jhtml_t* jhtml, Node* node) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<p>", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the P tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The P tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+s_jhtml_end_p_tag(jhtml_t* jhtml, Node* child) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</p>", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the PRE tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The PRE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+s_jhtml_start_pre_tag(jhtml_t* jhtml, Node* node) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->pre_flag++;
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<pre>", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the PRE tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The PRE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+s_jhtml_end_pre_tag(jhtml_t* jhtml, Node* child) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</pre>", NULL);
+  jhtml->pre_flag--;
+
+  return jhtml->out;
+}
+
+/**
  * It is a handler who processes the UL tag.
  *
  * @param jhtml  [i/o] The pointer to the CHTML structure at the output
index 0022ffe..7e28404 100644 (file)
@@ -545,15 +545,12 @@ chxj_init_module_kill(void *data)
   server_rec *base_server = (server_rec *)data;
   mod_chxj_global_config* conf;
 
-  DBG(base_server, "start chxj_init_module_kill()");
 
   /*--------------------------------------------------------------------------*/
   /* The setting of each server is acquired.                                  */
   /*--------------------------------------------------------------------------*/
   conf = ap_get_module_config(base_server->module_config, &chxj_module);
 
-  DBG(base_server, "end chxj_init_module_kill()");
-
   return APR_SUCCESS;
 }