Fossil SCM

Be careful to honor the auto-hyperlinks setting when it is off, and not display any hyperlinks. See [forum:5a7530639a|forum post 5a7530639a] for the bug report.

drh 2020-09-18 13:18 trunk
Commit b190858e97d3f31b6a825e2bf44d3bd03373624cd21562e0c08bc2de30cd6940
1 file changed +5 -2
+5 -2
--- src/style.c
+++ src/style.c
@@ -140,10 +140,11 @@
140140
** typically.
141141
*/
142142
char *xhref(const char *zExtra, const char *zFormat, ...){
143143
char *zUrl;
144144
va_list ap;
145
+ if( !g.perm.Hyperlink ) return fossil_strdup("");
145146
va_start(ap, zFormat);
146147
zUrl = vmprintf(zFormat, ap);
147148
va_end(ap);
148149
if( g.perm.Hyperlink && !g.javascriptHyperlink ){
149150
char *zHUrl;
@@ -164,10 +165,11 @@
164165
}
165166
}
166167
char *chref(const char *zExtra, const char *zFormat, ...){
167168
char *zUrl;
168169
va_list ap;
170
+ if( !g.perm.Hyperlink ) return fossil_strdup("");
169171
va_start(ap, zFormat);
170172
zUrl = vmprintf(zFormat, ap);
171173
va_end(ap);
172174
if( g.perm.Hyperlink && !g.javascriptHyperlink ){
173175
char *zHUrl = mprintf("<a class=\"%s\" href=\"%h\">", zExtra, zUrl);
@@ -179,10 +181,11 @@
179181
zExtra, zUrl);
180182
}
181183
char *href(const char *zFormat, ...){
182184
char *zUrl;
183185
va_list ap;
186
+ if( !g.perm.Hyperlink ) return fossil_strdup("");
184187
va_start(ap, zFormat);
185188
zUrl = vmprintf(zFormat, ap);
186189
va_end(ap);
187190
if( g.perm.Hyperlink && !g.javascriptHyperlink ){
188191
char *zHUrl = mprintf("<a href=\"%h\">", zUrl);
@@ -708,11 +711,11 @@
708711
709712
/*
710713
** Generate code to load all required javascript files.
711714
*/
712715
static void style_load_all_js_files(void){
713
- if( needHrefJs ){
716
+ if( needHrefJs && g.perm.Hyperlink ){
714717
int nDelay = db_get_int("auto-hyperlink-delay",0);
715718
int bMouseover = db_get_boolean("auto-hyperlink-mouseover",0);
716719
@ <script id='href-data' type='application/json'>\
717720
@ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script>
718721
}
@@ -719,11 +722,11 @@
719722
@ <script nonce="%h(style_nonce())">/* style.c:%d(__LINE__) */
720723
@ function debugMsg(msg){
721724
@ var n = document.getElementById("debugMsg");
722725
@ if(n){n.textContent=msg;}
723726
@ }
724
- if( needHrefJs ){
727
+ if( needHrefJs && g.perm.Hyperlink ){
725728
@ /* href.js */
726729
cgi_append_content(builtin_text("href.js"),-1);
727730
}
728731
if( blob_size(&blobOnLoad)>0 ){
729732
@ window.onload = function(){
730733
--- src/style.c
+++ src/style.c
@@ -140,10 +140,11 @@
140 ** typically.
141 */
142 char *xhref(const char *zExtra, const char *zFormat, ...){
143 char *zUrl;
144 va_list ap;
 
145 va_start(ap, zFormat);
146 zUrl = vmprintf(zFormat, ap);
147 va_end(ap);
148 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
149 char *zHUrl;
@@ -164,10 +165,11 @@
164 }
165 }
166 char *chref(const char *zExtra, const char *zFormat, ...){
167 char *zUrl;
168 va_list ap;
 
169 va_start(ap, zFormat);
170 zUrl = vmprintf(zFormat, ap);
171 va_end(ap);
172 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
173 char *zHUrl = mprintf("<a class=\"%s\" href=\"%h\">", zExtra, zUrl);
@@ -179,10 +181,11 @@
179 zExtra, zUrl);
180 }
181 char *href(const char *zFormat, ...){
182 char *zUrl;
183 va_list ap;
 
184 va_start(ap, zFormat);
185 zUrl = vmprintf(zFormat, ap);
186 va_end(ap);
187 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
188 char *zHUrl = mprintf("<a href=\"%h\">", zUrl);
@@ -708,11 +711,11 @@
708
709 /*
710 ** Generate code to load all required javascript files.
711 */
712 static void style_load_all_js_files(void){
713 if( needHrefJs ){
714 int nDelay = db_get_int("auto-hyperlink-delay",0);
715 int bMouseover = db_get_boolean("auto-hyperlink-mouseover",0);
716 @ <script id='href-data' type='application/json'>\
717 @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script>
718 }
@@ -719,11 +722,11 @@
719 @ <script nonce="%h(style_nonce())">/* style.c:%d(__LINE__) */
720 @ function debugMsg(msg){
721 @ var n = document.getElementById("debugMsg");
722 @ if(n){n.textContent=msg;}
723 @ }
724 if( needHrefJs ){
725 @ /* href.js */
726 cgi_append_content(builtin_text("href.js"),-1);
727 }
728 if( blob_size(&blobOnLoad)>0 ){
729 @ window.onload = function(){
730
--- src/style.c
+++ src/style.c
@@ -140,10 +140,11 @@
140 ** typically.
141 */
142 char *xhref(const char *zExtra, const char *zFormat, ...){
143 char *zUrl;
144 va_list ap;
145 if( !g.perm.Hyperlink ) return fossil_strdup("");
146 va_start(ap, zFormat);
147 zUrl = vmprintf(zFormat, ap);
148 va_end(ap);
149 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
150 char *zHUrl;
@@ -164,10 +165,11 @@
165 }
166 }
167 char *chref(const char *zExtra, const char *zFormat, ...){
168 char *zUrl;
169 va_list ap;
170 if( !g.perm.Hyperlink ) return fossil_strdup("");
171 va_start(ap, zFormat);
172 zUrl = vmprintf(zFormat, ap);
173 va_end(ap);
174 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
175 char *zHUrl = mprintf("<a class=\"%s\" href=\"%h\">", zExtra, zUrl);
@@ -179,10 +181,11 @@
181 zExtra, zUrl);
182 }
183 char *href(const char *zFormat, ...){
184 char *zUrl;
185 va_list ap;
186 if( !g.perm.Hyperlink ) return fossil_strdup("");
187 va_start(ap, zFormat);
188 zUrl = vmprintf(zFormat, ap);
189 va_end(ap);
190 if( g.perm.Hyperlink && !g.javascriptHyperlink ){
191 char *zHUrl = mprintf("<a href=\"%h\">", zUrl);
@@ -708,11 +711,11 @@
711
712 /*
713 ** Generate code to load all required javascript files.
714 */
715 static void style_load_all_js_files(void){
716 if( needHrefJs && g.perm.Hyperlink ){
717 int nDelay = db_get_int("auto-hyperlink-delay",0);
718 int bMouseover = db_get_boolean("auto-hyperlink-mouseover",0);
719 @ <script id='href-data' type='application/json'>\
720 @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script>
721 }
@@ -719,11 +722,11 @@
722 @ <script nonce="%h(style_nonce())">/* style.c:%d(__LINE__) */
723 @ function debugMsg(msg){
724 @ var n = document.getElementById("debugMsg");
725 @ if(n){n.textContent=msg;}
726 @ }
727 if( needHrefJs && g.perm.Hyperlink ){
728 @ /* href.js */
729 cgi_append_content(builtin_text("href.js"),-1);
730 }
731 if( blob_size(&blobOnLoad)>0 ){
732 @ window.onload = function(){
733

Keyboard Shortcuts

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