OSDN Git Service

* changed feature.
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 13 Feb 2008 11:56:27 +0000 (11:56 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Wed, 13 Feb 2008 11:56:27 +0000 (11:56 +0000)
    - meta tag convertor.

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@1846 1a406e8e-add9-4483-a2c8-d8cac5b7c224

src/chxj_chtml20.c
src/chxj_chtml30.c
src/chxj_xhtml_mobile_1_0.c

index f46f40d..c5d8ea2 100644 (file)
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "mod_chxj.h"
 #include "chxj_chtml20.h"
 #include "chxj_hdml.h"
 #include "chxj_str_util.h"
@@ -91,6 +92,7 @@ static char *s_chtml20_chxjif_tag(void *pdoc, Node *node);
 static char *s_chtml20_text_tag(void *pdoc, Node *node);
 
 
+
 tag_handler chtml20_handler[] = {
   /* tagHTML */
   {
@@ -543,11 +545,9 @@ s_chtml20_start_meta_tag(void *pdoc, Node *node)
                         "\"",
                         NULL);
   
-        if ((*value == 'c' || *value == 'C') 
-        && strcasecmp(value, "content-type") == 0)
+        if (STRCASEEQ('c','C',"content-type",value))
           content_type_flag = 1;
-        if ((*value == 'r' || *value == 'R')
-        && strcasecmp(value, "refresh") == 0)
+        if (STRCASEEQ('r','R',"refresh", value))
           refresh_flag = 1;
       }
       break;
@@ -556,17 +556,28 @@ s_chtml20_start_meta_tag(void *pdoc, Node *node)
     case 'C':
       if (strcasecmp(name, "content") == 0) {
         if (content_type_flag) {
-          chtml20->out = apr_pstrcat(r->pool,
-                          chtml20->out,
-                          " ",
-                          name,
-                          "=\"",
-                          "text/html; charset=Windows-31J",
-                          "\"",
-                          NULL);
+          if (IS_SJIS_STRING(GET_SPEC_CHARSET(chtml20->spec))) {
+            chtml20->out = apr_pstrcat(r->pool,
+                                       chtml20->out,
+                                       " ",
+                                       name,
+                                       "=\"",
+                                       "text/html; charset=Windows-31J",
+                                       "\"",
+                                       NULL);
+          }
+          else {
+            chtml20->out = apr_pstrcat(r->pool,
+                                       chtml20->out,
+                                       " ",
+                                       name,
+                                       "=\"",
+                                       "text/html; charset=UTF-8",
+                                       "\"",
+                                       NULL);
+          }
         }
-        else
-        if (refresh_flag) {
+        else if (refresh_flag) {
           char* buf = apr_pstrdup(r->pool, value);
           char* sec;
           char* url;
index cdfd168..54051d4 100644 (file)
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "mod_chxj.h"
 #include "chxj_chtml30.h"
 #include "chxj_hdml.h"
 #include "chxj_str_util.h"
@@ -542,12 +543,10 @@ s_chtml30_start_meta_tag(void *pdoc, Node *node)
                                    "\"",
                                    NULL);
   
-        if ((*value == 'c' || *value == 'C') 
-        && strcasecmp(value, "content-type") == 0)
+        if (STRCASEEQ('c','C',"content-type", value))
           content_type_flag = 1;
   
-        if ((*value == 'r' || *value == 'R')
-        && strcasecmp(value, "refresh") == 0)
+        if (STRCASEEQ('r','R',"refresh", value))
           refresh_flag = 1;
       }
       break;
@@ -556,14 +555,26 @@ s_chtml30_start_meta_tag(void *pdoc, Node *node)
     case 'C':
       if (strcasecmp(name, "content") == 0) {
         if (content_type_flag) {
-          chtml30->out = apr_pstrcat(r->pool,
-                                     chtml30->out,
-                                     " ",
-                                     name,
-                                     "=\"",
-                                    "text/html; charset=Windows-31J",
-                                    "\"",
-                                    NULL);
+          if (IS_SJIS_STRING(GET_SPEC_CHARSET(chtml30->spec))) {
+            chtml30->out = apr_pstrcat(r->pool,
+                                       chtml30->out,
+                                       " ",
+                                       name,
+                                       "=\"",
+                                      "text/html; charset=Windows-31J",
+                                      "\"",
+                                      NULL);
+          }
+          else {
+            chtml30->out = apr_pstrcat(r->pool,
+                                       chtml30->out,
+                                       " ",
+                                       name,
+                                       "=\"",
+                                      "text/html; charset=UTF-8",
+                                      "\"",
+                                      NULL);
+          }
         }
         else
         if (refresh_flag) {
index f71f28f..ecc9eaa 100644 (file)
@@ -565,7 +565,7 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
        attr = qs_get_next_attr(doc,attr)) {
     char *name  = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
-    if (strcasecmp(name, "name") == 0) {
+    if (STRCASEEQ('n','N', "name", name)) {
       xhtml->out = apr_pstrcat(r->pool,
                       xhtml->out,
                       " ", 
@@ -575,8 +575,7 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
                       "\"", 
                       NULL);
     }
-    else
-    if (strcasecmp(name, "http-equiv") == 0) {
+    else if (STRCASEEQ('h','H',"http-equiv", name)) {
       xhtml->out = apr_pstrcat(r->pool,
                       xhtml->out,
                       " ", 
@@ -585,21 +584,32 @@ s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node)
                       value,
                       "\"", 
                       NULL);
-      if ((*value == 'c' || *value == 'C') && strcasecmp(value, "content-type") == 0) {
+      if (STRCASEEQ('c','C',"content-type", value)) {
         content_type_flag = 1;
       }
     }
-    else
-    if (strcasecmp(name, "content") == 0) {
+    else if (STRCASEEQ('c','C',"content", name)) {
       if (content_type_flag) {
-        xhtml->out = apr_pstrcat(r->pool,
-                        xhtml->out, 
-                        " ", 
-                        name, 
-                        "=\"", 
-                        "text/html; charset=Windows-31J", 
-                        "\"", 
-                        NULL);
+        if (IS_SJIS_STRING(GET_SPEC_CHARSET(xhtml->spec))) {
+          xhtml->out = apr_pstrcat(r->pool,
+                                   xhtml->out, 
+                                   " ", 
+                                   name, 
+                                   "=\"", 
+                                   "text/html; charset=Windows-31J", 
+                                   "\"", 
+                                   NULL);
+        }
+        else {
+          xhtml->out = apr_pstrcat(r->pool,
+                                   xhtml->out, 
+                                   " ", 
+                                   name, 
+                                   "=\"", 
+                                   "text/html; charset=UTF-8", 
+                                   "\"", 
+                                   NULL);
+        }
       }
       else {
         xhtml->out = apr_pstrcat(r->pool,