Fossil SCM

Fix a bug in HTML attribute parsing.

drh 2010-05-24 18:43 trunk
Commit cb44f7dea478e9b08127a27dc37b7697bce22748
1 file changed +25 -20
+25 -20
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -39,29 +39,30 @@
3939
#define ATTR_ALT 2
4040
#define ATTR_BGCOLOR 3
4141
#define ATTR_BORDER 4
4242
#define ATTR_CELLPADDING 5
4343
#define ATTR_CELLSPACING 6
44
-#define ATTR_CLEAR 7
45
-#define ATTR_COLOR 8
46
-#define ATTR_COLSPAN 9
47
-#define ATTR_COMPACT 10
48
-#define ATTR_FACE 11
49
-#define ATTR_HEIGHT 12
50
-#define ATTR_HREF 13
51
-#define ATTR_HSPACE 14
52
-#define ATTR_ID 15
53
-#define ATTR_NAME 16
54
-#define ATTR_ROWSPAN 17
55
-#define ATTR_SIZE 18
56
-#define ATTR_SRC 19
57
-#define ATTR_START 20
58
-#define ATTR_TYPE 21
59
-#define ATTR_VALIGN 22
60
-#define ATTR_VALUE 23
61
-#define ATTR_VSPACE 24
62
-#define ATTR_WIDTH 25
44
+#define ATTR_CLASS 7
45
+#define ATTR_CLEAR 8
46
+#define ATTR_COLOR 9
47
+#define ATTR_COLSPAN 10
48
+#define ATTR_COMPACT 11
49
+#define ATTR_FACE 12
50
+#define ATTR_HEIGHT 13
51
+#define ATTR_HREF 14
52
+#define ATTR_HSPACE 15
53
+#define ATTR_ID 16
54
+#define ATTR_NAME 17
55
+#define ATTR_ROWSPAN 18
56
+#define ATTR_SIZE 19
57
+#define ATTR_SRC 20
58
+#define ATTR_START 21
59
+#define ATTR_TYPE 22
60
+#define ATTR_VALIGN 23
61
+#define ATTR_VALUE 24
62
+#define ATTR_VSPACE 25
63
+#define ATTR_WIDTH 26
6364
#define AMSK_ALIGN 0x0000001
6465
#define AMSK_ALT 0x0000002
6566
#define AMSK_BGCOLOR 0x0000004
6667
#define AMSK_BORDER 0x0000008
6768
#define AMSK_CELLPADDING 0x0000010
@@ -752,11 +753,11 @@
752753
if( p->aAttr[i].zValue ){
753754
const char *zVal = p->aAttr[i].zValue;
754755
if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){
755756
blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal);
756757
}else{
757
- blob_appendf(pOut, "=\"%s\"", p->aAttr[i].zValue);
758
+ blob_appendf(pOut, "=\"%s\"", zVal);
758759
}
759760
}
760761
}
761762
blob_append(pOut, ">", 1);
762763
}
@@ -1086,10 +1087,14 @@
10861087
ParsedMarkup markup;
10871088
int n;
10881089
int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
10891090
int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0;
10901091
1092
+ /* Make sure the attribute constants and names still align
1093
+ ** following changes in the attribute list. */
1094
+ assert( strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 );
1095
+
10911096
while( z[0] ){
10921097
if( wikiUseHtml ){
10931098
n = nextRawToken(z, p, &tokenType);
10941099
}else{
10951100
n = nextWikiToken(z, p, &tokenType);
10961101
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -39,29 +39,30 @@
39 #define ATTR_ALT 2
40 #define ATTR_BGCOLOR 3
41 #define ATTR_BORDER 4
42 #define ATTR_CELLPADDING 5
43 #define ATTR_CELLSPACING 6
44 #define ATTR_CLEAR 7
45 #define ATTR_COLOR 8
46 #define ATTR_COLSPAN 9
47 #define ATTR_COMPACT 10
48 #define ATTR_FACE 11
49 #define ATTR_HEIGHT 12
50 #define ATTR_HREF 13
51 #define ATTR_HSPACE 14
52 #define ATTR_ID 15
53 #define ATTR_NAME 16
54 #define ATTR_ROWSPAN 17
55 #define ATTR_SIZE 18
56 #define ATTR_SRC 19
57 #define ATTR_START 20
58 #define ATTR_TYPE 21
59 #define ATTR_VALIGN 22
60 #define ATTR_VALUE 23
61 #define ATTR_VSPACE 24
62 #define ATTR_WIDTH 25
 
63 #define AMSK_ALIGN 0x0000001
64 #define AMSK_ALT 0x0000002
65 #define AMSK_BGCOLOR 0x0000004
66 #define AMSK_BORDER 0x0000008
67 #define AMSK_CELLPADDING 0x0000010
@@ -752,11 +753,11 @@
752 if( p->aAttr[i].zValue ){
753 const char *zVal = p->aAttr[i].zValue;
754 if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){
755 blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal);
756 }else{
757 blob_appendf(pOut, "=\"%s\"", p->aAttr[i].zValue);
758 }
759 }
760 }
761 blob_append(pOut, ">", 1);
762 }
@@ -1086,10 +1087,14 @@
1086 ParsedMarkup markup;
1087 int n;
1088 int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
1089 int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0;
1090
 
 
 
 
1091 while( z[0] ){
1092 if( wikiUseHtml ){
1093 n = nextRawToken(z, p, &tokenType);
1094 }else{
1095 n = nextWikiToken(z, p, &tokenType);
1096
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -39,29 +39,30 @@
39 #define ATTR_ALT 2
40 #define ATTR_BGCOLOR 3
41 #define ATTR_BORDER 4
42 #define ATTR_CELLPADDING 5
43 #define ATTR_CELLSPACING 6
44 #define ATTR_CLASS 7
45 #define ATTR_CLEAR 8
46 #define ATTR_COLOR 9
47 #define ATTR_COLSPAN 10
48 #define ATTR_COMPACT 11
49 #define ATTR_FACE 12
50 #define ATTR_HEIGHT 13
51 #define ATTR_HREF 14
52 #define ATTR_HSPACE 15
53 #define ATTR_ID 16
54 #define ATTR_NAME 17
55 #define ATTR_ROWSPAN 18
56 #define ATTR_SIZE 19
57 #define ATTR_SRC 20
58 #define ATTR_START 21
59 #define ATTR_TYPE 22
60 #define ATTR_VALIGN 23
61 #define ATTR_VALUE 24
62 #define ATTR_VSPACE 25
63 #define ATTR_WIDTH 26
64 #define AMSK_ALIGN 0x0000001
65 #define AMSK_ALT 0x0000002
66 #define AMSK_BGCOLOR 0x0000004
67 #define AMSK_BORDER 0x0000008
68 #define AMSK_CELLPADDING 0x0000010
@@ -752,11 +753,11 @@
753 if( p->aAttr[i].zValue ){
754 const char *zVal = p->aAttr[i].zValue;
755 if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){
756 blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal);
757 }else{
758 blob_appendf(pOut, "=\"%s\"", zVal);
759 }
760 }
761 }
762 blob_append(pOut, ">", 1);
763 }
@@ -1086,10 +1087,14 @@
1087 ParsedMarkup markup;
1088 int n;
1089 int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
1090 int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0;
1091
1092 /* Make sure the attribute constants and names still align
1093 ** following changes in the attribute list. */
1094 assert( strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 );
1095
1096 while( z[0] ){
1097 if( wikiUseHtml ){
1098 n = nextRawToken(z, p, &tokenType);
1099 }else{
1100 n = nextWikiToken(z, p, &tokenType);
1101

Keyboard Shortcuts

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