Check-in [a4d7e9162d]
Not logged in
Overview

SHA1 Hash:a4d7e9162dc506a3b482514c5cbcb7fd075d6326
Date: 2008-05-16 13:55:05
User: drh
Comment:Preserve the case of unknown HTML markup on wiki pages.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/wikiformat.c from [43e274f49a] to [1c1385ba0c].

@@ -599,44 +599,41 @@
 **
 ** The content of z[] might be modified by converting characters
 ** to lowercase and by inserting some "\000" characters.
 */
 static void parseMarkup(ParsedMarkup *p, char *z){
-  int i, c;
+  int i, j, c;
   int iCode;
-  char *zTag, *zValue;
+  char *zValue;
   int seen = 0;
+  char zTag[100];
 
   if( z[1]=='/' ){
     p->endTag = 1;
     i = 2;
   }else{
     p->endTag = 0;
     i = 1;
   }
-  zTag = &z[i];
+  j = 0;
   while( isalnum(z[i]) ){
-    z[i] = tolower(z[i]);
+    if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
     i++;
   }
-  c = z[i];
-  z[i] = 0;
+  zTag[j] = 0;
   p->iCode = findTag(zTag);
   p->iType = aMarkup[p->iCode].iType;
   p->nAttr = 0;
-  z[i] = c;
   while( isspace(z[i]) ){ i++; }
   while( p->nAttr<8 && isalpha(z[i]) ){
-    zTag = &z[i];
+    j = 0;
     while( isalnum(z[i]) ){
-      z[i] = tolower(z[i]);
+      if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
       i++;
     }
-    c = z[i];
-    z[i] = 0;
-    p->aAttr[p->nAttr].iCode = iCode = findAttr(zTag);
-    z[i] = c;
+    zTag[j] = 0;
+    p->aAttr[p->nAttr].iCode = iCode = findAttr(zTag);
     while( isspace(z[i]) ){ z++; }
     if( z[i]!='=' ){
       p->aAttr[p->nAttr].zValue = 0;
       p->aAttr[p->nAttr].cTerm = 0;
       c = 0;
@@ -658,12 +655,12 @@
     }
     if( iCode!=0 && (seen & aAttribute[iCode].iMask)==0 ){
       seen |= aAttribute[iCode].iMask;
       p->nAttr++;
     }
-    if( c=='>' ) break;
     while( isspace(z[i]) ){ i++; }
+    if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
   }
 }
 
 /*
 ** Render markup on the given blob.