summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-06 11:10:27 -0500
committerUnknwon <u@gogs.io>2015-11-06 11:10:27 -0500
commit54ca0b2f0923b01ba152a3e2a9efdb6256d95571 (patch)
tree8d13e2cc60886f0ad56b50a6e65e82301fedf53b
parent2bd64621fc7bff3fa5cf25b438b4e2895d58db54 (diff)
downloadgitea-54ca0b2f0923b01ba152a3e2a9efdb6256d95571.tar.gz
gitea-54ca0b2f0923b01ba152a3e2a9efdb6256d95571.zip
#1433 images with links in Markdown
- #1904 minor fix on image link
-rw-r--r--README.md2
-rw-r--r--gogs.go2
-rw-r--r--modules/base/markdown.go11
-rw-r--r--templates/.VERSION2
4 files changed, 13 insertions, 4 deletions
diff --git a/README.md b/README.md
index af73f126ee..3e3005197d 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png)
-##### Current version: 0.6.27 Beta
+##### Current version: 0.6.28 Beta
<table>
<tr>
diff --git a/gogs.go b/gogs.go
index 742075affa..a05efadf58 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.6.27.1105 Beta"
+const APP_VER = "0.6.28.1106 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index 540ee58f47..e59a6273ab 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -100,11 +100,20 @@ func (options *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte,
}
func (options *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
+ prefix := strings.Replace(options.urlPrefix, "/src/", "/raw/", 1)
if len(link) > 0 && !isLink(link) {
- link = []byte(path.Join(strings.Replace(options.urlPrefix, "/src/", "/raw/", 1), string(link)))
+ if link[0] != '/' {
+ prefix += "/"
+ }
+ link = []byte(prefix + string(link))
}
+ fmt.Println(2, string(link))
+ out.WriteString(`<a href="`)
+ out.Write(link)
+ out.WriteString(`">`)
options.Renderer.Image(out, link, title, alt)
+ out.WriteString("</a>")
}
var (
diff --git a/templates/.VERSION b/templates/.VERSION
index 5e5efc3029..a943b65b10 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.6.27.1105 Beta \ No newline at end of file
+0.6.28.1106 Beta \ No newline at end of file