Differences From:
File
src/wikiformat.c
part of check-in
[1bbc5b7e6c]
- Fix bugs in the rendering of HTML markup with multiple attributes. This
clears up a problem in displaying the "concepts.wiki" documentation file.
by
drh on
2008-05-16 00:56:01.
[view]
To:
File
src/wikiformat.c
part of check-in
[a4d7e9162d]
- Preserve the case of unknown HTML markup on wiki pages.
by
drh on
2008-05-16 13:55:05.
[view]
@@ -600,12 +600,13 @@
** 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;
@@ -612,30 +613,26 @@
}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;
@@ -659,10 +656,10 @@
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;
}
}
/*