From 3ff0a126e12109b6c3aceaa229dd1bf229b6ad4b Mon Sep 17 00:00:00 2001 From: mrsdizzie Date: Fri, 12 Apr 2019 01:53:34 -0400 Subject: Improve issue autolinks (#6273) * Improve issue autolinks Update autolinks to match what github does here: Issue in same repo: #1 Issue in different repo: org/repo#1 Fixes #6264 * Use setting.AppURL when parsing URL Using setting.AppURL here is a more reliable way of parsing the current URL and what other functions in this file seem to use. * Make ComposeMetas always return a valid context * Add per repository markdown renderers for better context * Update for use of context metas Now that we include the user and repo name inside context metas, update various code and tests for this new logic --- modules/markup/markdown/markdown_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'modules/markup/markdown') diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index 5aa9c3d7d2..8ba51e6a1b 100644 --- a/modules/markup/markdown/markdown_test.go +++ b/modules/markup/markdown/markdown_test.go @@ -19,6 +19,12 @@ const AppURL = "http://localhost:3000/" const Repo = "gogits/gogs" const AppSubURL = AppURL + Repo + "/" +// these values should match the Repo const above +var localMetas = map[string]string{ + "user": "gogits", + "repo": "gogs", +} + func TestRender_StandardLinks(t *testing.T) { setting.AppURL = AppURL setting.AppSubURL = AppSubURL @@ -100,7 +106,8 @@ func testAnswers(baseURLContent, baseURLImages string) []string {

Ideas and codes