OSDN Git Service

a@id/name for XHTML(ez,y!)
authorcoltware@gmail.com <coltware@gmail.com>
Wed, 25 Nov 2009 17:06:07 +0000 (17:06 +0000)
committerAtsushi Konno <atkonn@gmail.com>
Thu, 10 Dec 2009 03:28:43 +0000 (12:28 +0900)
src/chxj_jxhtml.c
src/chxj_xhtml_mobile_1_0.c

index 08f99ef..afe049b 100755 (executable)
@@ -1246,6 +1246,7 @@ s_jxhtml_start_a_tag(void *pdoc, Node *node)
   request_rec *r;
   Attr        *attr;
   char        *attr_style = NULL;
+  char        *attr_id    = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
@@ -1260,13 +1261,11 @@ s_jxhtml_start_a_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 (STRCASEEQ('n','N',"name",name)) {
-      /*----------------------------------------------------------------------*/
-      /* CHTML1.0                                                             */
-      /*----------------------------------------------------------------------*/
-      W_L(" name=\"");
-      W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
-      W_L("\"");
+    if (STRCASEEQ('i','I',"id",name)){
+      attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
+    }
+    else if (STRCASEEQ('n','N',"name",name)) {
+      attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
     }
     else if (STRCASEEQ('h','H',"href",name)) {
       /*----------------------------------------------------------------------*/
@@ -1358,6 +1357,11 @@ s_jxhtml_start_a_tag(void *pdoc, Node *node)
       attr_style = value;
     }
   }
+  if(attr_id){
+    W_L(" name=\"");
+    W_V(attr_id);
+    W_L("\"");
+  }
   W_L(">");
 
   if (IS_CSS_ON(jxhtml->entryp)) {
index f78ba68..f71fa76 100755 (executable)
@@ -1202,6 +1202,7 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
   request_rec *r     = doc->r;
   Attr        *attr;
   char        *attr_style = NULL;
+  char        *attr_id    = NULL;
 
   W_L("<a");
   /*--------------------------------------------------------------------------*/
@@ -1212,10 +1213,11 @@ s_xhtml_1_0_start_a_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 (STRCASEEQ('n','N',"name",name) && value && *value) {
-      W_L(" id=\"");
-      W_V(value);
-      W_L("\"");
+    if (STRCASEEQ('i','I',"id",name)){
+      attr_id = apr_pstrdup(doc->buf.pool, value);
+    }
+    else if (STRCASEEQ('n','N',"name",name)) {
+      attr_id = apr_pstrdup(doc->buf.pool, value);
     }
     else if (STRCASEEQ('h','H',"href", name) && value && *value) {
       value = chxj_encoding_parameter(r, value, 1);
@@ -1265,6 +1267,11 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
       attr_style = value;
     }
   }
+  if(attr_id){
+    W_L(" id=\"");
+    W_V(attr_id);
+    W_L("\"");
+  }
   W_L(">");
 
   if (IS_CSS_ON(xhtml->entryp)) {