forked from Gitlink/gitea-1120-rc1
fix:add htmlcontent
This commit is contained in:
parent
d3f8e67e57
commit
6b34e16a7c
|
@ -33,7 +33,7 @@ type WikiUser struct {
|
|||
type WikiResponse struct {
|
||||
WikiMeta
|
||||
CommitCounts int64 `json:"commit_counts"`
|
||||
Content string `json:"content"`
|
||||
WikiContent Content `json:"wiki_content"`
|
||||
}
|
||||
|
||||
type WikiOption struct {
|
||||
|
@ -45,3 +45,7 @@ type CloneLink struct {
|
|||
SSH string `json:"ssh"`
|
||||
HTTPS string `json:"https"`
|
||||
}
|
||||
type Content struct{
|
||||
HtmlContent string `json:"http_content"`
|
||||
MdContent string `json:"md_content"`
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
func WikiList(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/wikies repository repoWikiList
|
||||
// ---
|
||||
// summary: List the hooks in a repository
|
||||
// summary: List the wikies in a repository
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
|
@ -154,6 +154,7 @@ func GetWiki(ctx *context.APIContext) {
|
|||
}
|
||||
metas := ctx.Repo.Repository.ComposeDocumentMetas()
|
||||
PageContent := markdown.RenderWiki(data, ctx.Repo.RepoLink, metas)
|
||||
|
||||
c, err := wikiRepo.GetCommitByPath(entry.Name())
|
||||
if err != nil {
|
||||
if models.IsErrWikiInvalidFileName(err) {
|
||||
|
@ -181,7 +182,10 @@ func GetWiki(ctx *context.APIContext) {
|
|||
},
|
||||
},
|
||||
CommitCounts: commitsCount,
|
||||
Content: PageContent,
|
||||
WikiContent:api.Content{
|
||||
HtmlContent: string(data),
|
||||
MdContent: PageContent,
|
||||
},
|
||||
}
|
||||
ctx.JSON(http.StatusOK, wiki)
|
||||
}
|
||||
|
@ -215,7 +219,7 @@ func CreateWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
if err2 != nil{
|
||||
ctx.ServerError("CreateWikiPage", err2)
|
||||
}
|
||||
|
||||
fmt.Println("content", form.Content)
|
||||
wikiRepo, commit, _ := wikies.FindWikiRepoCommit(ctx)
|
||||
|
||||
data, entry, pageFilename, _:= wikies.WikiContentsByName(ctx, commit, form.Name)
|
||||
|
@ -233,7 +237,6 @@ func CreateWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
return
|
||||
}
|
||||
}
|
||||
fmt.Println(form)
|
||||
wiki := api.WikiResponse{
|
||||
WikiMeta: api.WikiMeta{
|
||||
Name: form.Name,
|
||||
|
@ -254,7 +257,10 @@ func CreateWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
},
|
||||
},
|
||||
CommitCounts: commitsCount,
|
||||
Content: PageContent,
|
||||
WikiContent: api.Content{
|
||||
HtmlContent: string(data),
|
||||
MdContent: PageContent,
|
||||
},
|
||||
}
|
||||
ctx.JSON(http.StatusOK, wiki)
|
||||
|
||||
|
@ -337,7 +343,10 @@ func EditWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
},
|
||||
},
|
||||
CommitCounts: commitsCount,
|
||||
Content: PageContent,
|
||||
WikiContent: api.Content{
|
||||
HtmlContent: string(data),
|
||||
MdContent: PageContent,
|
||||
},
|
||||
}
|
||||
ctx.JSON(http.StatusOK, wiki)
|
||||
|
||||
|
|
Loading…
Reference in New Issue