#1433 images with links in Markdown

- #1904 minor fix on image link
tokarchuk/v1.17
Unknwon 9 years ago
parent 2bd64621fc
commit 54ca0b2f09
  1. 2
      README.md
  2. 2
      gogs.go
  3. 11
      modules/base/markdown.go
  4. 2
      templates/.VERSION

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png) ![](public/img/gogs-large-resize.png)
##### Current version: 0.6.27 Beta ##### Current version: 0.6.28 Beta
<table> <table>
<tr> <tr>

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.6.27.1105 Beta" const APP_VER = "0.6.28.1106 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

@ -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) { 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) { 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) options.Renderer.Image(out, link, title, alt)
out.WriteString("</a>")
} }
var ( var (

@ -1 +1 @@
0.6.27.1105 Beta 0.6.28.1106 Beta
Loading…
Cancel
Save