Fossil SCM
Accept single-quotes in addition to double-quotes for HTML attribute quoting.
Commit
852e631f08691fbb713460dd3b04c18255023334
Parent
1f607de1db8a9a3…
1 file changed
+11
-4
+11
-4
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -392,17 +392,20 @@ | ||
| 392 | 392 | ** it is not well-formed markup, return 0. |
| 393 | 393 | */ |
| 394 | 394 | static int markupLength(const char *z){ |
| 395 | 395 | int n = 1; |
| 396 | 396 | int inparen = 0; |
| 397 | + int c; | |
| 397 | 398 | if( z[n]=='/' ){ n++; } |
| 398 | 399 | if( !isalpha(z[n]) ) return 0; |
| 399 | 400 | while( isalnum(z[n]) ){ n++; } |
| 400 | - if( z[n]!='>' && !isspace(z[n]) ) return 0; | |
| 401 | - while( z[n] && (z[n]!='>' || inparen) ){ | |
| 402 | - if( z[n]=='"' ){ | |
| 403 | - inparen = !inparen; | |
| 401 | + if( (c = z[n])!='>' && !isspace(c) ) return 0; | |
| 402 | + while( (c = z[n])!=0 && (c!='>' || inparen) ){ | |
| 403 | + if( c==inparen ){ | |
| 404 | + inparen = 0; | |
| 405 | + }else if( c=='"' || c=='\'' ){ | |
| 406 | + inparen = c; | |
| 404 | 407 | } |
| 405 | 408 | n++; |
| 406 | 409 | } |
| 407 | 410 | if( z[n]!='>' ) return 0; |
| 408 | 411 | return n+1; |
| @@ -713,10 +716,14 @@ | ||
| 713 | 716 | while( isspace(z[i]) ){ z++; } |
| 714 | 717 | if( z[i]=='"' ){ |
| 715 | 718 | i++; |
| 716 | 719 | zValue = &z[i]; |
| 717 | 720 | while( z[i] && z[i]!='"' ){ i++; } |
| 721 | + }else if( z[i]=='\'' ){ | |
| 722 | + i++; | |
| 723 | + zValue = &z[i]; | |
| 724 | + while( z[i] && z[i]!='\'' ){ i++; } | |
| 718 | 725 | }else{ |
| 719 | 726 | zValue = &z[i]; |
| 720 | 727 | while( !isspace(z[i]) && z[i]!='>' ){ z++; } |
| 721 | 728 | } |
| 722 | 729 | if( attrOk ){ |
| 723 | 730 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -392,17 +392,20 @@ | |
| 392 | ** it is not well-formed markup, return 0. |
| 393 | */ |
| 394 | static int markupLength(const char *z){ |
| 395 | int n = 1; |
| 396 | int inparen = 0; |
| 397 | if( z[n]=='/' ){ n++; } |
| 398 | if( !isalpha(z[n]) ) return 0; |
| 399 | while( isalnum(z[n]) ){ n++; } |
| 400 | if( z[n]!='>' && !isspace(z[n]) ) return 0; |
| 401 | while( z[n] && (z[n]!='>' || inparen) ){ |
| 402 | if( z[n]=='"' ){ |
| 403 | inparen = !inparen; |
| 404 | } |
| 405 | n++; |
| 406 | } |
| 407 | if( z[n]!='>' ) return 0; |
| 408 | return n+1; |
| @@ -713,10 +716,14 @@ | |
| 713 | while( isspace(z[i]) ){ z++; } |
| 714 | if( z[i]=='"' ){ |
| 715 | i++; |
| 716 | zValue = &z[i]; |
| 717 | while( z[i] && z[i]!='"' ){ i++; } |
| 718 | }else{ |
| 719 | zValue = &z[i]; |
| 720 | while( !isspace(z[i]) && z[i]!='>' ){ z++; } |
| 721 | } |
| 722 | if( attrOk ){ |
| 723 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -392,17 +392,20 @@ | |
| 392 | ** it is not well-formed markup, return 0. |
| 393 | */ |
| 394 | static int markupLength(const char *z){ |
| 395 | int n = 1; |
| 396 | int inparen = 0; |
| 397 | int c; |
| 398 | if( z[n]=='/' ){ n++; } |
| 399 | if( !isalpha(z[n]) ) return 0; |
| 400 | while( isalnum(z[n]) ){ n++; } |
| 401 | if( (c = z[n])!='>' && !isspace(c) ) return 0; |
| 402 | while( (c = z[n])!=0 && (c!='>' || inparen) ){ |
| 403 | if( c==inparen ){ |
| 404 | inparen = 0; |
| 405 | }else if( c=='"' || c=='\'' ){ |
| 406 | inparen = c; |
| 407 | } |
| 408 | n++; |
| 409 | } |
| 410 | if( z[n]!='>' ) return 0; |
| 411 | return n+1; |
| @@ -713,10 +716,14 @@ | |
| 716 | while( isspace(z[i]) ){ z++; } |
| 717 | if( z[i]=='"' ){ |
| 718 | i++; |
| 719 | zValue = &z[i]; |
| 720 | while( z[i] && z[i]!='"' ){ i++; } |
| 721 | }else if( z[i]=='\'' ){ |
| 722 | i++; |
| 723 | zValue = &z[i]; |
| 724 | while( z[i] && z[i]!='\'' ){ i++; } |
| 725 | }else{ |
| 726 | zValue = &z[i]; |
| 727 | while( !isspace(z[i]) && z[i]!='>' ){ z++; } |
| 728 | } |
| 729 | if( attrOk ){ |
| 730 |