OSDN Git Service

* add ![CDATA[.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 5 Jul 2006 16:17:10 +0000 (16:17 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 5 Jul 2006 16:17:10 +0000 (16:17 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@1703 1a406e8e-add9-4483-a2c8-d8cac5b7c224

include/mod_chxj.h
include/qs_parse_string.h
src/chxj_chtml10.c
src/chxj_chtml20.c
src/chxj_chtml30.c
src/chxj_hdml.c
src/chxj_jhtml.c
src/chxj_node_exchange.c
src/chxj_xhtml_mobile_1_0.c
src/qs_parse_string.c

index 84221be..ab1365c 100644 (file)
@@ -257,6 +257,7 @@ typedef enum {
   tagTH,  
   tagB,
   tagFIELDSET,
+  tagDT,
 } tag_type;
 
 typedef struct mod_chxj_config mod_chxj_config;
index c407922..9ae9cfb 100644 (file)
 #define QX_ALLOC_MAX   (100*1024)
 
 /**
- * It is judged whether it is the first byte of Japanese Shift_JIS "ZENKAKU KANJI". 
+ * It is judged whether it is the first byte of Japanese Shift_JIS 
+ * "ZENKAKU KANJI". 
  */
-#define is_sjis_kanji(c)  ((0x81 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0x9f)  \
-                          || (0xe0 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xfc))
+#define is_sjis_kanji(c)  ((0x81 <= (unsigned char)(c&0xff) && \
+                           (unsigned char)(c&0xff) <= 0x9f)  \
+                          || (0xe0 <= (unsigned char)(c&0xff) && \
+                           (unsigned char)(c&0xff) <= 0xfc))
 /**
  * It is judged whether it is a byte of Japanese Shift_JIS "HANKAKU KANA". 
  */
@@ -79,7 +82,8 @@
                         &&  (strcasecmp(c, "?xml"     ) != 0) \
                         &&  (strcasecmp(c, "!doctype" ) != 0) \
                         &&  (strcasecmp(c, "link"     ) != 0) \
-                        &&  (strcasecmp(c, "!--"      ) != 0))
+                        &&  (strcasecmp(c, "!--"      ) != 0) \
+                        &&  (strncasecmp(c, "![CDATA[",8) != 0))
 
 /**
  * It is judged whether the tag of the object has the child element. 
index f114854..cb64536 100644 (file)
@@ -302,6 +302,11 @@ tag_handler chtml10_handler[] = {
     NULL,
     NULL,
   },
+  /* tagDT */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index a3300b7..cc79661 100644 (file)
@@ -304,6 +304,11 @@ tag_handler chtml20_handler[] = {
     NULL,
     NULL,
   },
+  /* tagDT */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 /**
index b07ddf7..ddc415a 100644 (file)
@@ -303,6 +303,11 @@ tag_handler chtml30_handler[] = {
     NULL,
     NULL,
   },
+  /* tagDT */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index 5d77198..837aca0 100644 (file)
@@ -304,6 +304,11 @@ tag_handler hdml_handler[] = {
     NULL,
     NULL,
   },
+  /* tagDT */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 /**
index 888f6cc..d622a9e 100644 (file)
@@ -295,6 +295,11 @@ tag_handler jhtml_handler[] = {
     NULL,
     NULL,
   },
+  /* tagDT */
+  {
+    NULL,
+    NULL,
+  },
 };
 
 
index 853b7bb..124a37b 100644 (file)
@@ -556,9 +556,9 @@ chxj_node_exchange(
 
     case 'c':
     case 'C':
-      /*------------------------------------------------------------------------*/
-      /* <CENTER>                                                               */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* <CENTER>                                                             */
+      /*----------------------------------------------------------------------*/
       if (strcasecmp(name, "center") == 0) {
         if (handlers[tagCENTER].start_tag_handler) 
           handlers[tagCENTER].start_tag_handler(pdoc, child);
@@ -568,9 +568,9 @@ chxj_node_exchange(
         if (handlers[tagCENTER].end_tag_handler)
           handlers[tagCENTER].end_tag_handler(pdoc, child);
       }
-      /*------------------------------------------------------------------------*/
-      /* <CHXJ:IF>                                                              */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* <CHXJ:IF>                                                            */
+      /*----------------------------------------------------------------------*/
       else
       if (strcasecmp(name, "chxj:if") == 0) {
         if (chxj_chxjif_is_mine(spec, doc, child)) {
@@ -616,9 +616,9 @@ chxj_node_exchange(
         if (handlers[tagTITLE].end_tag_handler)
           handlers[tagTITLE].end_tag_handler(pdoc, child);
       }
-      /*------------------------------------------------------------------------*/
-      /* <TABLE>                                                                */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* <TABLE>                                                              */
+      /*----------------------------------------------------------------------*/
       else
       if (strcasecmp(name, "table") == 0) {
         if (handlers[tagTABLE].start_tag_handler) 
@@ -629,9 +629,9 @@ chxj_node_exchange(
         if (handlers[tagTABLE].end_tag_handler)
           handlers[tagTABLE].end_tag_handler(pdoc, child);
       }
-      /*------------------------------------------------------------------------*/
-      /* <TBODY>                                                                */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* <TBODY>                                                              */
+      /*----------------------------------------------------------------------*/
       else
       if (strcasecmp(name, "tbody") == 0) {
         if (handlers[tagTBODY].start_tag_handler) 
@@ -642,9 +642,9 @@ chxj_node_exchange(
         if (handlers[tagTBODY].end_tag_handler)
           handlers[tagTBODY].end_tag_handler(pdoc, child);
       }
-      /*------------------------------------------------------------------------*/
-      /* <TH>                                                                   */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* <TH>                                                                 */
+      /*----------------------------------------------------------------------*/
       else
       if (strcasecmp(name, "th") == 0) {
         if (handlers[tagTH].start_tag_handler) 
@@ -655,9 +655,9 @@ chxj_node_exchange(
         if (handlers[tagTH].end_tag_handler)
           handlers[tagTH].end_tag_handler(pdoc, child);
       }
-      /*------------------------------------------------------------------------*/
-      /* <TR>                                                                   */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* <TR>                                                                 */
+      /*----------------------------------------------------------------------*/
       else
       if (strcasecmp(name, "tr") == 0) {
         if (handlers[tagTR].start_tag_handler) 
@@ -668,9 +668,9 @@ chxj_node_exchange(
         if (handlers[tagTR].end_tag_handler)
           handlers[tagTR].end_tag_handler(pdoc, child);
       }
-      /*------------------------------------------------------------------------*/
-      /* <TD>                                                                   */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* <TD>                                                                 */
+      /*----------------------------------------------------------------------*/
       else
       if (strcasecmp(name, "td") == 0) {
         if (handlers[tagTD].start_tag_handler) 
@@ -681,11 +681,11 @@ chxj_node_exchange(
         if (handlers[tagTD].end_tag_handler)
           handlers[tagTD].end_tag_handler(pdoc, child);
       }
-      /*------------------------------------------------------------------------*/
-      /* NORMAL TEXT                                                            */
-      /*------------------------------------------------------------------------*/
+      /*----------------------------------------------------------------------*/
+      /* NORMAL TEXT                                                          */
+      /*----------------------------------------------------------------------*/
       else
-      if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
+      if (strcasecmp(name, "text") == 0) {
         if (handlers[tagTEXT].start_tag_handler)
           handlers[tagTEXT].start_tag_handler(pdoc, child);
       }
index 887ccbc..c6b9158 100644 (file)
@@ -304,6 +304,11 @@ tag_handler xhtml_handler[] = {
     NULL,
     NULL,
   },
+  /* tagDT */
+  {
+    NULL,
+    NULL,
+  },
 };
  
 /**
index 677d33c..227d394 100644 (file)
@@ -154,14 +154,25 @@ qs_parse_string(Doc* doc, const char* src, int srclen)
 
       ii += endpoint;
       if (node->name[0] == '/' ) {
-
-        if ((doc->parse_mode == PARSE_MODE_CHTML && has_child(&(node->name[1])))
-        ||  (doc->parse_mode == PARSE_MODE_NO_PARSE 
-        &&  (node->name[1] == 'c' || node->name[1] == 'C')
-        &&  strcasecmp(&node->name[1], "chxj:if") == 0)) {
-          if (doc->now_parent_node->parent != NULL) {
-            doc->now_parent_node = doc->now_parent_node->parent;
-            doc->parse_mode = PARSE_MODE_CHTML;
+        if (doc->parse_mode == PARSE_MODE_CHTML) {
+          if (has_child(&(node->name[1]))) {
+            if (doc->now_parent_node->parent != NULL) {
+              doc->now_parent_node = doc->now_parent_node->parent;
+              doc->parse_mode = PARSE_MODE_CHTML;
+            }
+          }
+          else {
+            continue;
+          }
+        }
+        else
+        if (doc->parse_mode == PARSE_MODE_NO_PARSE) {
+          if ((node->name[1] == 'c' || node->name[1] == 'C')
+          &&  strcasecmp(&node->name[1], "chxj:if") == 0) {
+            if (doc->now_parent_node->parent != NULL) {
+              doc->now_parent_node = doc->now_parent_node->parent;
+              doc->parse_mode = PARSE_MODE_CHTML;
+            }
           }
         }