mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-21 11:24:02 +08:00
3f9c3e7bc3
There were too many patches to the Render system, it's really difficult to make further improvements. This PR clears the legacy problems and fix TODOs. 1. Rename `RenderContext.Type` to `RenderContext.MarkupType` to clarify its usage. 2. Use `ContentMode` to replace `meta["mode"]` and `IsWiki`, to clarify the rendering behaviors. 3. Use "wiki" mode instead of "mode=gfm + wiki=true" 4. Merge `renderByType` and `renderByFile` 5. Add more comments ---- The problem of "mode=document": in many cases it is not set, so many non-comment places use comment's hard line break incorrectly
106 lines
2.4 KiB
Go
106 lines
2.4 KiB
Go
// Copyright 2015 The Gogs Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package structs
|
|
|
|
// SearchResults results of a successful search
|
|
type SearchResults struct {
|
|
OK bool `json:"ok"`
|
|
Data []*Repository `json:"data"`
|
|
}
|
|
|
|
// SearchError error of a failed search
|
|
type SearchError struct {
|
|
OK bool `json:"ok"`
|
|
Error string `json:"error"`
|
|
}
|
|
|
|
// MarkupOption markup options
|
|
type MarkupOption struct {
|
|
// Text markup to render
|
|
//
|
|
// in: body
|
|
Text string
|
|
// Mode to render (markdown, comment, wiki, file)
|
|
//
|
|
// in: body
|
|
Mode string
|
|
// URL path for rendering issue, media and file links
|
|
// Expected format: /subpath/{user}/{repo}/src/{branch, commit, tag}/{identifier/path}/{file/dir}
|
|
//
|
|
// in: body
|
|
Context string
|
|
// Is it a wiki page? (use mode=wiki instead)
|
|
//
|
|
// Deprecated: true
|
|
// in: body
|
|
Wiki bool
|
|
// File path for detecting extension in file mode
|
|
//
|
|
// in: body
|
|
FilePath string
|
|
}
|
|
|
|
// MarkupRender is a rendered markup document
|
|
// swagger:response MarkupRender
|
|
type MarkupRender string
|
|
|
|
// MarkdownOption markdown options
|
|
type MarkdownOption struct {
|
|
// Text markdown to render
|
|
//
|
|
// in: body
|
|
Text string
|
|
// Mode to render (markdown, comment, wiki, file)
|
|
//
|
|
// in: body
|
|
Mode string
|
|
// URL path for rendering issue, media and file links
|
|
// Expected format: /subpath/{user}/{repo}/src/{branch, commit, tag}/{identifier/path}/{file/dir}
|
|
//
|
|
// in: body
|
|
Context string
|
|
// Is it a wiki page? (use mode=wiki instead)
|
|
//
|
|
// Deprecated: true
|
|
// in: body
|
|
Wiki bool
|
|
}
|
|
|
|
// MarkdownRender is a rendered markdown document
|
|
// swagger:response MarkdownRender
|
|
type MarkdownRender string
|
|
|
|
// ServerVersion wraps the version of the server
|
|
type ServerVersion struct {
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
// GitignoreTemplateInfo name and text of a gitignore template
|
|
type GitignoreTemplateInfo struct {
|
|
Name string `json:"name"`
|
|
Source string `json:"source"`
|
|
}
|
|
|
|
// LicensesListEntry is used for the API
|
|
type LicensesTemplateListEntry struct {
|
|
Key string `json:"key"`
|
|
Name string `json:"name"`
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
// LicensesInfo contains information about a License
|
|
type LicenseTemplateInfo struct {
|
|
Key string `json:"key"`
|
|
Name string `json:"name"`
|
|
URL string `json:"url"`
|
|
Implementation string `json:"implementation"`
|
|
Body string `json:"body"`
|
|
}
|
|
|
|
// APIError is an api error with a message
|
|
type APIError struct {
|
|
Message string `json:"message"`
|
|
URL string `json:"url"`
|
|
}
|