Fossil SCM
For Markdown hyperlinks, if the URL begins with "/" then prepend the root of repository. This allows repository-relative hyperlinks.
Commit
38a4707413e3b3b246f2b418b6bbcd3f2d24241f
Parent
ef449a1173c556b…
1 file changed
+6
+6
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -355,11 +355,17 @@ | ||
| 355 | 355 | struct Blob *link, |
| 356 | 356 | struct Blob *title, |
| 357 | 357 | struct Blob *content, |
| 358 | 358 | void *opaque |
| 359 | 359 | ){ |
| 360 | + char *zLink = blob_buffer(link); | |
| 360 | 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 | + } | |
| 361 | 367 | html_escape(ob, blob_buffer(link), blob_size(link)); |
| 362 | 368 | if( title && blob_size(title)>0 ){ |
| 363 | 369 | BLOB_APPEND_LITERAL(ob, "\" title=\""); |
| 364 | 370 | html_escape(ob, blob_buffer(title), blob_size(title)); |
| 365 | 371 | } |
| 366 | 372 |
| --- 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 |