Fossil SCM

Accept single-quotes in addition to double-quotes for HTML attribute quoting.

drh 2010-04-07 11:53 trunk
Commit 852e631f08691fbb713460dd3b04c18255023334
1 file changed +11 -4
+11 -4
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -392,17 +392,20 @@
392392
** it is not well-formed markup, return 0.
393393
*/
394394
static int markupLength(const char *z){
395395
int n = 1;
396396
int inparen = 0;
397
+ int c;
397398
if( z[n]=='/' ){ n++; }
398399
if( !isalpha(z[n]) ) return 0;
399400
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;
404407
}
405408
n++;
406409
}
407410
if( z[n]!='>' ) return 0;
408411
return n+1;
@@ -713,10 +716,14 @@
713716
while( isspace(z[i]) ){ z++; }
714717
if( z[i]=='"' ){
715718
i++;
716719
zValue = &z[i];
717720
while( z[i] && z[i]!='"' ){ i++; }
721
+ }else if( z[i]=='\'' ){
722
+ i++;
723
+ zValue = &z[i];
724
+ while( z[i] && z[i]!='\'' ){ i++; }
718725
}else{
719726
zValue = &z[i];
720727
while( !isspace(z[i]) && z[i]!='>' ){ z++; }
721728
}
722729
if( attrOk ){
723730
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button