pkg/setting: rename {AppUrl, AppSubUrl} -> {AppURL, AppSubURL}

This commit is contained in:
Unknwon
2017-04-06 17:27:57 -04:00
parent 2c404daca6
commit 90b9f7e08c
98 changed files with 351 additions and 349 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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() {