Fossil SCM
fossil says valid html element is invalid
Fixed
675aaa3458199c8…
· opened 15 years, 6 months ago
- Type
- Code_Defect
- Priority
- —
- Severity
- Important
- Resolution
- Fixed
- Subsystem
- —
- Created
- Sept. 22, 2010 7:50 a.m.
<hr/> is a valid xhtml element. Fossil says it is not. However <hr /> and <hr id='hrid'/> are considered valid.
The problem is in wikiformat.c:markupLength in the line
while( isalnum(z[n]) ){ n++; }
==> if( (c = z[n])!='>' && !isspace(c) ) return 0;
while( (c = z[n])!=0 && (c!='>' || inparen) ){
renez added on 2010-09-24 21:51:04: looking further at the routine it will invalidate this to
- <img src="img.png" alt="d'art noir" title="/> black art" />
- < hr />
This will do a bit better but will still not catch all
like <hr//> will be valid
static int markupLength(const char *z){
int n = 1;
int quote;
int c;
if( z[n]=='/' ){ n++; }
while(isspace(z[n])) n++;
if( !isalpha(z[n]) ) return 0;
n++;
while(isalnum(z[n])) n++;
while( (c = z[n]) && c!='>'){
if( c=='"' || c=='\'' ){
n++;
for(quote=c; (c=z[n]) && c!=quote; n++) ; //look for the same closing quote
if(!c) return 0;
}
n++;
}
return c ? n+1 : c ;
}