aboutsummaryrefslogtreecommitdiff
path: root/pkg/markup
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-04-06 17:27:57 -0400
committerUnknwon <u@gogs.io>2017-04-06 17:27:57 -0400
commit90b9f7e08ca2e027cc587199537aa653ddd94d91 (patch)
tree0dbd625cd1eb929250befa07f18a0517ae23a5d1 /pkg/markup
parent2c404daca612b43bd6b0b720d3e732d9550c0eab (diff)
pkg/setting: rename {AppUrl, AppSubUrl} -> {AppURL, AppSubURL}
Diffstat (limited to 'pkg/markup')
-rw-r--r--pkg/markup/markdown.go6
-rw-r--r--pkg/markup/markdown_test.go4
-rw-r--r--pkg/markup/markup.go6
-rw-r--r--pkg/markup/markup_test.go2
4 files changed, 9 insertions, 9 deletions
diff --git a/pkg/markup/markdown.go b/pkg/markup/markdown.go
index 43f58806..741f6f55 100644
--- a/pkg/markup/markdown.go
+++ b/pkg/markup/markdown.go
@@ -63,7 +63,7 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
// Since this method could only possibly serve one link at a time,
// we do not need to find all.
- if bytes.HasPrefix(link, []byte(setting.AppUrl)) {
+ if bytes.HasPrefix(link, []byte(setting.AppURL)) {
m := CommitPattern.Find(link)
if m != nil {
m = bytes.TrimSpace(m)
@@ -86,14 +86,14 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
}
index := string(m[i+7 : j])
- fullRepoURL := setting.AppUrl + strings.TrimPrefix(r.urlPrefix, "/")
+ fullRepoURL := setting.AppURL + strings.TrimPrefix(r.urlPrefix, "/")
var link string
if strings.HasPrefix(string(m), fullRepoURL) {
// Use a short issue reference if the URL refers to this repository
link = fmt.Sprintf(`<a href="%s">#%s</a>`, m, index)
} else {
// Use a cross-repository issue reference if the URL refers to a different repository
- repo := string(m[len(setting.AppUrl) : i-1])
+ repo := string(m[len(setting.AppURL) : i-1])
link = fmt.Sprintf(`<a href="%s">%s#%s</a>`, m, repo, index)
}
out.WriteString(link)
diff --git a/pkg/markup/markdown_test.go b/pkg/markup/markdown_test.go
index a4bf074f..15a66b81 100644
--- a/pkg/markup/markdown_test.go
+++ b/pkg/markup/markdown_test.go
@@ -40,7 +40,7 @@ func Test_IsMarkdownFile(t *testing.T) {
func Test_Markdown(t *testing.T) {
Convey("Rendering an issue URL", t, func() {
- setting.AppUrl = "http://localhost:3000/"
+ setting.AppURL = "http://localhost:3000/"
htmlFlags := 0
htmlFlags |= blackfriday.HTML_SKIP_STYLE
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
@@ -82,7 +82,7 @@ func Test_Markdown(t *testing.T) {
})
Convey("Rendering a commit URL", t, func() {
- setting.AppUrl = "http://localhost:3000/"
+ setting.AppURL = "http://localhost:3000/"
htmlFlags := 0
htmlFlags |= blackfriday.HTML_SKIP_STYLE
htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
diff --git a/pkg/markup/markup.go b/pkg/markup/markup.go
index c5549b6c..9f5734a3 100644
--- a/pkg/markup/markup.go
+++ b/pkg/markup/markup.go
@@ -74,7 +74,7 @@ func cutoutVerbosePrefix(prefix string) string {
if prefix[i] == '/' {
count++
}
- if count >= 3+setting.AppSubUrlDepth {
+ if count >= 3+setting.AppSubURLDepth {
return prefix[:i]
}
}
@@ -128,7 +128,7 @@ func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, me
repo := string(m[:delimIdx])
index := string(m[delimIdx+1:])
- link := fmt.Sprintf(`<a href="%s%s/issues/%s">%s</a>`, setting.AppUrl, repo, index, m)
+ link := fmt.Sprintf(`<a href="%s%s/issues/%s">%s</a>`, setting.AppURL, repo, index, m)
rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1)
}
return rawBytes
@@ -150,7 +150,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]strin
for _, m := range ms {
m = m[bytes.Index(m, []byte("@")):]
rawBytes = bytes.Replace(rawBytes, m,
- []byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
+ []byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubURL, m[1:], m)), -1)
}
rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)
diff --git a/pkg/markup/markup_test.go b/pkg/markup/markup_test.go
index d3d72091..6e19a23c 100644
--- a/pkg/markup/markup_test.go
+++ b/pkg/markup/markup_test.go
@@ -62,7 +62,7 @@ func Test_RenderIssueIndexPattern(t *testing.T) {
urlPrefix = "/prefix"
metas map[string]string = nil
)
- setting.AppSubUrlDepth = 0
+ setting.AppSubURLDepth = 0
Convey("To the internal issue tracker", func() {
Convey("It should not render anything when there are no mentions", func() {