Fossil SCM
When rendering HTML pages using the fossil-doc class and the data-title="..." attribute, reverse the HTML escapes in the argument to data-title since they will be reencoded prior to rendering.
Commit
54e01c60e21827d3d3cebb5195621817c7795b560ede60e3bc6fc8c60c42dad6
Parent
ed63bdd71e74740…
1 file changed
+8
-1
+8
-1
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -451,11 +451,18 @@ | ||
| 451 | 451 | if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0; |
| 452 | 452 | seenClass = 1; |
| 453 | 453 | if( seenTitle ) return 1; |
| 454 | 454 | } |
| 455 | 455 | if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){ |
| 456 | - blob_append(pTitle, zValue, nValue); | |
| 456 | + /* The text argument to data-title="" will have had any characters that | |
| 457 | + ** are special to HTML encoded. We need to decode these before turning | |
| 458 | + ** the text into a title, as the title text will be reencoded later */ | |
| 459 | + char *zTitle = mprintf("%.*s", nValue, zValue); | |
| 460 | + int i; | |
| 461 | + for(i=0; fossil_isspace(zTitle[i]); i++){} | |
| 462 | + html_to_plaintext(zTitle+i, pTitle); | |
| 463 | + fossil_free(zTitle); | |
| 457 | 464 | seenTitle = 1; |
| 458 | 465 | if( seenClass ) return 1; |
| 459 | 466 | } |
| 460 | 467 | } |
| 461 | 468 | return seenClass; |
| 462 | 469 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -451,11 +451,18 @@ | |
| 451 | if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0; |
| 452 | seenClass = 1; |
| 453 | if( seenTitle ) return 1; |
| 454 | } |
| 455 | if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){ |
| 456 | blob_append(pTitle, zValue, nValue); |
| 457 | seenTitle = 1; |
| 458 | if( seenClass ) return 1; |
| 459 | } |
| 460 | } |
| 461 | return seenClass; |
| 462 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -451,11 +451,18 @@ | |
| 451 | if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0; |
| 452 | seenClass = 1; |
| 453 | if( seenTitle ) return 1; |
| 454 | } |
| 455 | if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){ |
| 456 | /* The text argument to data-title="" will have had any characters that |
| 457 | ** are special to HTML encoded. We need to decode these before turning |
| 458 | ** the text into a title, as the title text will be reencoded later */ |
| 459 | char *zTitle = mprintf("%.*s", nValue, zValue); |
| 460 | int i; |
| 461 | for(i=0; fossil_isspace(zTitle[i]); i++){} |
| 462 | html_to_plaintext(zTitle+i, pTitle); |
| 463 | fossil_free(zTitle); |
| 464 | seenTitle = 1; |
| 465 | if( seenClass ) return 1; |
| 466 | } |
| 467 | } |
| 468 | return seenClass; |
| 469 |