Skip to content

Commit 7ab3c39

Browse files
brechtvlwxiaoguang
authored andcommitted
Better document context option and expected route
Swagger did not render <> so use {}.
1 parent 9dca6d4 commit 7ab3c39

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

modules/structs/miscellaneous.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ type MarkupOption struct {
2525
//
2626
// in: body
2727
Mode string
28-
// Context to render
28+
// URL path for rendering issue, media and file links
29+
// Expected format: {user}/{repo}/src/{branch, commit, tag}/{identifier}/{filepath}
2930
//
3031
// in: body
3132
Context string
@@ -53,7 +54,8 @@ type MarkdownOption struct {
5354
//
5455
// in: body
5556
Mode string
56-
// Context to render
57+
// URL path for rendering issue, media and file links
58+
// Expected format: {user}/{repo}/src/{branch, commit, tag}/{identifier}/{filepath}
5759
//
5860
// in: body
5961
Context string

routers/common/markup.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func RenderMarkup(ctx *context.Base, repo *context.Repository, mode, text, urlPr
7272
}
7373

7474
// Parse branch path and tree path, for correct media links.
75+
// The expected route is "{user}/{repo}/src/{branch, commit, tag]/{identifier}"
7576
urlElements := strings.Split(strings.TrimPrefix(urlPrefix, setting.AppURL), "/")
7677
if len(urlElements) >= 5 && urlElements[2] == "src" {
7778
links = markup.Links{

templates/swagger/v1_json.tmpl

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)