Fossil SCM

For Markdown hyperlinks, if the URL begins with "/" then prepend the root of repository. This allows repository-relative hyperlinks.

drh 2016-06-10 13:06 trunk
Commit 38a4707413e3b3b246f2b418b6bbcd3f2d24241f
1 file changed +6
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -355,11 +355,17 @@
355355
struct Blob *link,
356356
struct Blob *title,
357357
struct Blob *content,
358358
void *opaque
359359
){
360
+ char *zLink = blob_buffer(link);
360361
BLOB_APPEND_LITERAL(ob, "<a href=\"");
362
+ if( zLink[0]=='/' ){
363
+ /* For any hyperlink that begins with "/", make it refer to the root
364
+ ** of the Fossil repository */
365
+ blob_append(ob, g.zTop, -1);
366
+ }
361367
html_escape(ob, blob_buffer(link), blob_size(link));
362368
if( title && blob_size(title)>0 ){
363369
BLOB_APPEND_LITERAL(ob, "\" title=\"");
364370
html_escape(ob, blob_buffer(title), blob_size(title));
365371
}
366372
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -355,11 +355,17 @@
355 struct Blob *link,
356 struct Blob *title,
357 struct Blob *content,
358 void *opaque
359 ){
 
360 BLOB_APPEND_LITERAL(ob, "<a href=\"");
 
 
 
 
 
361 html_escape(ob, blob_buffer(link), blob_size(link));
362 if( title && blob_size(title)>0 ){
363 BLOB_APPEND_LITERAL(ob, "\" title=\"");
364 html_escape(ob, blob_buffer(title), blob_size(title));
365 }
366
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -355,11 +355,17 @@
355 struct Blob *link,
356 struct Blob *title,
357 struct Blob *content,
358 void *opaque
359 ){
360 char *zLink = blob_buffer(link);
361 BLOB_APPEND_LITERAL(ob, "<a href=\"");
362 if( zLink[0]=='/' ){
363 /* For any hyperlink that begins with "/", make it refer to the root
364 ** of the Fossil repository */
365 blob_append(ob, g.zTop, -1);
366 }
367 html_escape(ob, blob_buffer(link), blob_size(link));
368 if( title && blob_size(title)>0 ){
369 BLOB_APPEND_LITERAL(ob, "\" title=\"");
370 html_escape(ob, blob_buffer(title), blob_size(title));
371 }
372

Keyboard Shortcuts

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