mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-13 19:02:19 +01:00
Handle .org files in Sidebar and footer of wiki
Used Git filename to properly handle .org files
This commit is contained in:
parent
cb9334414a
commit
cb38c046b2
@ -316,26 +316,38 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !isSideBar {
|
if !isSideBar {
|
||||||
sidebarContent, _, _, _ := wikiContentsByName(ctx, commit, "_Sidebar")
|
sidebarContent, sidebarEntry, sidebarFilename, _ := wikiContentsByName(ctx, commit, "_Sidebar")
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
ctx.Data["WikiSidebarEscapeStatus"], ctx.Data["WikiSidebarHTML"], err = renderFn(sidebarContent)
|
if sidebarEntry != nil && sidebarContent != nil {
|
||||||
if err != nil {
|
// Use the git filename returned by wikiContentsByName, which correctly handles .org files
|
||||||
ctx.ServerError("Render", err)
|
if sidebarFilename == "" {
|
||||||
return nil, nil
|
sidebarFilename = sidebarEntry.Name()
|
||||||
|
}
|
||||||
|
ctx.Data["WikiSidebarEscapeStatus"], ctx.Data["WikiSidebarHTML"], err = renderFn(sidebarContent, sidebarFilename)
|
||||||
|
if err != nil {
|
||||||
|
ctx.ServerError("Render", err)
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isFooter {
|
if !isFooter {
|
||||||
footerContent, _, _, _ := wikiContentsByName(ctx, commit, "_Footer")
|
footerContent, footerEntry, footerFilename, _ := wikiContentsByName(ctx, commit, "_Footer")
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
ctx.Data["WikiFooterEscapeStatus"], ctx.Data["WikiFooterHTML"], err = renderFn(footerContent)
|
if footerEntry != nil && footerContent != nil {
|
||||||
if err != nil {
|
// Use git filename here too to handle .org files correctly
|
||||||
ctx.ServerError("Render", err)
|
if footerFilename == "" {
|
||||||
return nil, nil
|
footerFilename = footerEntry.Name()
|
||||||
|
}
|
||||||
|
ctx.Data["WikiFooterEscapeStatus"], ctx.Data["WikiFooterHTML"], err = renderFn(footerContent, footerFilename)
|
||||||
|
if err != nil {
|
||||||
|
ctx.ServerError("Render", err)
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user