Fossil SCM

Integrate andygoth-quote-apostrophe. Needed because single quotes can be used in the tag filter entry, and these single quotes would otherwise be passed through unprotected to the output HTML.

andygoth 2016-11-04 20:49 andygoth-timeline-ms merge
Commit 68bd2e7bedb8d05a893978af8da12d61faaa18da
+13 -1
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
2323
/*
2424
** Make the given string safe for HTML by converting every "<" into "&lt;",
2525
** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
2626
** to a new string obtained from malloc().
2727
**
28
-** We also encode " as &quot; so that it can appear as an argument
28
+** We also encode " as &quot; and ' as &#39; so they can appear as an argument
2929
** to markup.
3030
*/
3131
char *htmlize(const char *zIn, int n){
3232
int c;
3333
int i = 0;
@@ -74,10 +74,17 @@
7474
zOut[i++] = 'u';
7575
zOut[i++] = 'o';
7676
zOut[i++] = 't';
7777
zOut[i++] = ';';
7878
break;
79
+ case '\'':
80
+ zOut[i++] = '&';
81
+ zOut[i++] = '#';
82
+ zOut[i++] = '3';
83
+ zOut[i++] = '9';
84
+ zOut[i++] = ';';
85
+ break;
7986
default:
8087
zOut[i++] = c;
8188
break;
8289
}
8390
zIn++;
@@ -112,10 +119,15 @@
112119
break;
113120
case '"':
114121
if( j<i ) blob_append(p, zIn+j, i-j);
115122
blob_append(p, "&quot;", 6);
116123
j = i+1;
124
+ break;
125
+ case '\'':
126
+ if( j<i ) blob_append(p, zIn+j, i-j);
127
+ blob_append(p, "&#39;", 5);
128
+ j = i+1;
117129
break;
118130
}
119131
}
120132
if( j<i ) blob_append(p, zIn+j, i-j);
121133
}
122134
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
23 /*
24 ** Make the given string safe for HTML by converting every "<" into "&lt;",
25 ** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
26 ** to a new string obtained from malloc().
27 **
28 ** We also encode " as &quot; so that it can appear as an argument
29 ** to markup.
30 */
31 char *htmlize(const char *zIn, int n){
32 int c;
33 int i = 0;
@@ -74,10 +74,17 @@
74 zOut[i++] = 'u';
75 zOut[i++] = 'o';
76 zOut[i++] = 't';
77 zOut[i++] = ';';
78 break;
 
 
 
 
 
 
 
79 default:
80 zOut[i++] = c;
81 break;
82 }
83 zIn++;
@@ -112,10 +119,15 @@
112 break;
113 case '"':
114 if( j<i ) blob_append(p, zIn+j, i-j);
115 blob_append(p, "&quot;", 6);
116 j = i+1;
 
 
 
 
 
117 break;
118 }
119 }
120 if( j<i ) blob_append(p, zIn+j, i-j);
121 }
122
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
23 /*
24 ** Make the given string safe for HTML by converting every "<" into "&lt;",
25 ** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
26 ** to a new string obtained from malloc().
27 **
28 ** We also encode " as &quot; and ' as &#39; so they can appear as an argument
29 ** to markup.
30 */
31 char *htmlize(const char *zIn, int n){
32 int c;
33 int i = 0;
@@ -74,10 +74,17 @@
74 zOut[i++] = 'u';
75 zOut[i++] = 'o';
76 zOut[i++] = 't';
77 zOut[i++] = ';';
78 break;
79 case '\'':
80 zOut[i++] = '&';
81 zOut[i++] = '#';
82 zOut[i++] = '3';
83 zOut[i++] = '9';
84 zOut[i++] = ';';
85 break;
86 default:
87 zOut[i++] = c;
88 break;
89 }
90 zIn++;
@@ -112,10 +119,15 @@
119 break;
120 case '"':
121 if( j<i ) blob_append(p, zIn+j, i-j);
122 blob_append(p, "&quot;", 6);
123 j = i+1;
124 break;
125 case '\'':
126 if( j<i ) blob_append(p, zIn+j, i-j);
127 blob_append(p, "&#39;", 5);
128 j = i+1;
129 break;
130 }
131 }
132 if( j<i ) blob_append(p, zIn+j, i-j);
133 }
134
+13 -1
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
2323
/*
2424
** Make the given string safe for HTML by converting every "<" into "&lt;",
2525
** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
2626
** to a new string obtained from malloc().
2727
**
28
-** We also encode " as &quot; so that it can appear as an argument
28
+** We also encode " as &quot; and ' as &#39; so they can appear as an argument
2929
** to markup.
3030
*/
3131
char *htmlize(const char *zIn, int n){
3232
int c;
3333
int i = 0;
@@ -74,10 +74,17 @@
7474
zOut[i++] = 'u';
7575
zOut[i++] = 'o';
7676
zOut[i++] = 't';
7777
zOut[i++] = ';';
7878
break;
79
+ case '\'':
80
+ zOut[i++] = '&';
81
+ zOut[i++] = '#';
82
+ zOut[i++] = '3';
83
+ zOut[i++] = '9';
84
+ zOut[i++] = ';';
85
+ break;
7986
default:
8087
zOut[i++] = c;
8188
break;
8289
}
8390
zIn++;
@@ -112,10 +119,15 @@
112119
break;
113120
case '"':
114121
if( j<i ) blob_append(p, zIn+j, i-j);
115122
blob_append(p, "&quot;", 6);
116123
j = i+1;
124
+ break;
125
+ case '\'':
126
+ if( j<i ) blob_append(p, zIn+j, i-j);
127
+ blob_append(p, "&#39;", 5);
128
+ j = i+1;
117129
break;
118130
}
119131
}
120132
if( j<i ) blob_append(p, zIn+j, i-j);
121133
}
122134
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
23 /*
24 ** Make the given string safe for HTML by converting every "<" into "&lt;",
25 ** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
26 ** to a new string obtained from malloc().
27 **
28 ** We also encode " as &quot; so that it can appear as an argument
29 ** to markup.
30 */
31 char *htmlize(const char *zIn, int n){
32 int c;
33 int i = 0;
@@ -74,10 +74,17 @@
74 zOut[i++] = 'u';
75 zOut[i++] = 'o';
76 zOut[i++] = 't';
77 zOut[i++] = ';';
78 break;
 
 
 
 
 
 
 
79 default:
80 zOut[i++] = c;
81 break;
82 }
83 zIn++;
@@ -112,10 +119,15 @@
112 break;
113 case '"':
114 if( j<i ) blob_append(p, zIn+j, i-j);
115 blob_append(p, "&quot;", 6);
116 j = i+1;
 
 
 
 
 
117 break;
118 }
119 }
120 if( j<i ) blob_append(p, zIn+j, i-j);
121 }
122
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
23 /*
24 ** Make the given string safe for HTML by converting every "<" into "&lt;",
25 ** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
26 ** to a new string obtained from malloc().
27 **
28 ** We also encode " as &quot; and ' as &#39; so they can appear as an argument
29 ** to markup.
30 */
31 char *htmlize(const char *zIn, int n){
32 int c;
33 int i = 0;
@@ -74,10 +74,17 @@
74 zOut[i++] = 'u';
75 zOut[i++] = 'o';
76 zOut[i++] = 't';
77 zOut[i++] = ';';
78 break;
79 case '\'':
80 zOut[i++] = '&';
81 zOut[i++] = '#';
82 zOut[i++] = '3';
83 zOut[i++] = '9';
84 zOut[i++] = ';';
85 break;
86 default:
87 zOut[i++] = c;
88 break;
89 }
90 zIn++;
@@ -112,10 +119,15 @@
119 break;
120 case '"':
121 if( j<i ) blob_append(p, zIn+j, i-j);
122 blob_append(p, "&quot;", 6);
123 j = i+1;
124 break;
125 case '\'':
126 if( j<i ) blob_append(p, zIn+j, i-j);
127 blob_append(p, "&#39;", 5);
128 j = i+1;
129 break;
130 }
131 }
132 if( j<i ) blob_append(p, zIn+j, i-j);
133 }
134
+13 -1
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
2323
/*
2424
** Make the given string safe for HTML by converting every "<" into "&lt;",
2525
** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
2626
** to a new string obtained from malloc().
2727
**
28
-** We also encode " as &quot; so that it can appear as an argument
28
+** We also encode " as &quot; and ' as &#39; so they can appear as an argument
2929
** to markup.
3030
*/
3131
char *htmlize(const char *zIn, int n){
3232
int c;
3333
int i = 0;
@@ -74,10 +74,17 @@
7474
zOut[i++] = 'u';
7575
zOut[i++] = 'o';
7676
zOut[i++] = 't';
7777
zOut[i++] = ';';
7878
break;
79
+ case '\'':
80
+ zOut[i++] = '&';
81
+ zOut[i++] = '#';
82
+ zOut[i++] = '3';
83
+ zOut[i++] = '9';
84
+ zOut[i++] = ';';
85
+ break;
7986
default:
8087
zOut[i++] = c;
8188
break;
8289
}
8390
zIn++;
@@ -112,10 +119,15 @@
112119
break;
113120
case '"':
114121
if( j<i ) blob_append(p, zIn+j, i-j);
115122
blob_append(p, "&quot;", 6);
116123
j = i+1;
124
+ break;
125
+ case '\'':
126
+ if( j<i ) blob_append(p, zIn+j, i-j);
127
+ blob_append(p, "&#39;", 5);
128
+ j = i+1;
117129
break;
118130
}
119131
}
120132
if( j<i ) blob_append(p, zIn+j, i-j);
121133
}
122134
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
23 /*
24 ** Make the given string safe for HTML by converting every "<" into "&lt;",
25 ** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
26 ** to a new string obtained from malloc().
27 **
28 ** We also encode " as &quot; so that it can appear as an argument
29 ** to markup.
30 */
31 char *htmlize(const char *zIn, int n){
32 int c;
33 int i = 0;
@@ -74,10 +74,17 @@
74 zOut[i++] = 'u';
75 zOut[i++] = 'o';
76 zOut[i++] = 't';
77 zOut[i++] = ';';
78 break;
 
 
 
 
 
 
 
79 default:
80 zOut[i++] = c;
81 break;
82 }
83 zIn++;
@@ -112,10 +119,15 @@
112 break;
113 case '"':
114 if( j<i ) blob_append(p, zIn+j, i-j);
115 blob_append(p, "&quot;", 6);
116 j = i+1;
 
 
 
 
 
117 break;
118 }
119 }
120 if( j<i ) blob_append(p, zIn+j, i-j);
121 }
122
--- src/encode.c
+++ src/encode.c
@@ -23,11 +23,11 @@
23 /*
24 ** Make the given string safe for HTML by converting every "<" into "&lt;",
25 ** every ">" into "&gt;" and every "&" into "&amp;". Return a pointer
26 ** to a new string obtained from malloc().
27 **
28 ** We also encode " as &quot; and ' as &#39; so they can appear as an argument
29 ** to markup.
30 */
31 char *htmlize(const char *zIn, int n){
32 int c;
33 int i = 0;
@@ -74,10 +74,17 @@
74 zOut[i++] = 'u';
75 zOut[i++] = 'o';
76 zOut[i++] = 't';
77 zOut[i++] = ';';
78 break;
79 case '\'':
80 zOut[i++] = '&';
81 zOut[i++] = '#';
82 zOut[i++] = '3';
83 zOut[i++] = '9';
84 zOut[i++] = ';';
85 break;
86 default:
87 zOut[i++] = c;
88 break;
89 }
90 zIn++;
@@ -112,10 +119,15 @@
119 break;
120 case '"':
121 if( j<i ) blob_append(p, zIn+j, i-j);
122 blob_append(p, "&quot;", 6);
123 j = i+1;
124 break;
125 case '\'':
126 if( j<i ) blob_append(p, zIn+j, i-j);
127 blob_append(p, "&#39;", 5);
128 j = i+1;
129 break;
130 }
131 }
132 if( j<i ) blob_append(p, zIn+j, i-j);
133 }
134
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
7272
BLOB_APPEND_LITERAL(ob, "&gt;");
7373
}else if( data[i]=='&' ){
7474
BLOB_APPEND_LITERAL(ob, "&amp;");
7575
}else if( data[i]=='"' ){
7676
BLOB_APPEND_LITERAL(ob, "&quot;");
77
+ }else if( data[i]=='\'' ){
78
+ BLOB_APPEND_LITERAL(ob, "&#39;");
7779
}else{
7880
break;
7981
}
8082
i++;
8183
}
8284
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
72 BLOB_APPEND_LITERAL(ob, "&gt;");
73 }else if( data[i]=='&' ){
74 BLOB_APPEND_LITERAL(ob, "&amp;");
75 }else if( data[i]=='"' ){
76 BLOB_APPEND_LITERAL(ob, "&quot;");
 
 
77 }else{
78 break;
79 }
80 i++;
81 }
82
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
72 BLOB_APPEND_LITERAL(ob, "&gt;");
73 }else if( data[i]=='&' ){
74 BLOB_APPEND_LITERAL(ob, "&amp;");
75 }else if( data[i]=='"' ){
76 BLOB_APPEND_LITERAL(ob, "&quot;");
77 }else if( data[i]=='\'' ){
78 BLOB_APPEND_LITERAL(ob, "&#39;");
79 }else{
80 break;
81 }
82 i++;
83 }
84
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
7272
BLOB_APPEND_LITERAL(ob, "&gt;");
7373
}else if( data[i]=='&' ){
7474
BLOB_APPEND_LITERAL(ob, "&amp;");
7575
}else if( data[i]=='"' ){
7676
BLOB_APPEND_LITERAL(ob, "&quot;");
77
+ }else if( data[i]=='\'' ){
78
+ BLOB_APPEND_LITERAL(ob, "&#39;");
7779
}else{
7880
break;
7981
}
8082
i++;
8183
}
8284
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
72 BLOB_APPEND_LITERAL(ob, "&gt;");
73 }else if( data[i]=='&' ){
74 BLOB_APPEND_LITERAL(ob, "&amp;");
75 }else if( data[i]=='"' ){
76 BLOB_APPEND_LITERAL(ob, "&quot;");
 
 
77 }else{
78 break;
79 }
80 i++;
81 }
82
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
72 BLOB_APPEND_LITERAL(ob, "&gt;");
73 }else if( data[i]=='&' ){
74 BLOB_APPEND_LITERAL(ob, "&amp;");
75 }else if( data[i]=='"' ){
76 BLOB_APPEND_LITERAL(ob, "&quot;");
77 }else if( data[i]=='\'' ){
78 BLOB_APPEND_LITERAL(ob, "&#39;");
79 }else{
80 break;
81 }
82 i++;
83 }
84
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
7272
BLOB_APPEND_LITERAL(ob, "&gt;");
7373
}else if( data[i]=='&' ){
7474
BLOB_APPEND_LITERAL(ob, "&amp;");
7575
}else if( data[i]=='"' ){
7676
BLOB_APPEND_LITERAL(ob, "&quot;");
77
+ }else if( data[i]=='\'' ){
78
+ BLOB_APPEND_LITERAL(ob, "&#39;");
7779
}else{
7880
break;
7981
}
8082
i++;
8183
}
8284
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
72 BLOB_APPEND_LITERAL(ob, "&gt;");
73 }else if( data[i]=='&' ){
74 BLOB_APPEND_LITERAL(ob, "&amp;");
75 }else if( data[i]=='"' ){
76 BLOB_APPEND_LITERAL(ob, "&quot;");
 
 
77 }else{
78 break;
79 }
80 i++;
81 }
82
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -72,10 +72,12 @@
72 BLOB_APPEND_LITERAL(ob, "&gt;");
73 }else if( data[i]=='&' ){
74 BLOB_APPEND_LITERAL(ob, "&amp;");
75 }else if( data[i]=='"' ){
76 BLOB_APPEND_LITERAL(ob, "&quot;");
77 }else if( data[i]=='\'' ){
78 BLOB_APPEND_LITERAL(ob, "&#39;");
79 }else{
80 break;
81 }
82 i++;
83 }
84

Keyboard Shortcuts

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