From 7b089c465d9f851454be91ca209ab26782648a45 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 5 May 2022 15:53:38 +0800 Subject: [PATCH] Remove `RequireHighlightJS` field, update plantuml example. (#19615) --- .../doc/advanced/customizing-gitea.en-us.md | 17 ++++++++++------- routers/web/explore/code.go | 1 - routers/web/repo/cherry_pick.go | 3 --- routers/web/repo/commit.go | 1 - routers/web/repo/editor.go | 2 -- routers/web/repo/issue.go | 3 --- routers/web/repo/patch.go | 3 --- routers/web/repo/pull.go | 2 -- routers/web/repo/search.go | 1 - routers/web/repo/webhook.go | 2 -- routers/web/repo/wiki.go | 3 --- 11 files changed, 10 insertions(+), 28 deletions(-) diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md index 1a8386fc3e1..ef798ddbf96 100644 --- a/docs/content/doc/advanced/customizing-gitea.en-us.md +++ b/docs/content/doc/advanced/customizing-gitea.en-us.md @@ -132,15 +132,18 @@ copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highl `$GITEA_CUSTOM/public` folder. Then add the following to `custom/footer.tmpl`: ```html -{{if .RequireHighlightJS}} - - - -{{end}} ``` You can then add blocks like the following to your markdown: diff --git a/routers/web/explore/code.go b/routers/web/explore/code.go index 28bdc7c9ca5..41ca27782f9 100644 --- a/routers/web/explore/code.go +++ b/routers/web/explore/code.go @@ -138,7 +138,6 @@ func Code(ctx *context.Context) { ctx.Data["queryType"] = queryType ctx.Data["SearchResults"] = searchResults ctx.Data["SearchResultLanguages"] = searchResultLanguages - ctx.Data["RequireHighlightJS"] = true ctx.Data["PageIsViewCode"] = true pager := context.NewPagination(total, setting.UI.RepoSearchPagingNum, page, 5) diff --git a/routers/web/repo/cherry_pick.go b/routers/web/repo/cherry_pick.go index 6667d274108..d2a4e19d0ea 100644 --- a/routers/web/repo/cherry_pick.go +++ b/routers/web/repo/cherry_pick.go @@ -47,8 +47,6 @@ func CherryPick(ctx *context.Context) { ctx.Data["commit_message"] = splits[1] } - ctx.Data["RequireHighlightJS"] = true - canCommit := renderCommitRights(ctx) ctx.Data["TreePath"] = "" @@ -77,7 +75,6 @@ func CherryPickPost(ctx *context.Context) { ctx.Data["CherryPickType"] = "cherry-pick" } - ctx.Data["RequireHighlightJS"] = true canCommit := renderCommitRights(ctx) branchName := ctx.Repo.BranchName if form.CommitChoice == frmCommitChoiceNewBranch { diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go index 59d818672a8..7f68fd3dd17 100644 --- a/routers/web/repo/commit.go +++ b/routers/web/repo/commit.go @@ -253,7 +253,6 @@ func FileHistory(ctx *context.Context) { // Diff show different from current commit to previous commit func Diff(ctx *context.Context) { ctx.Data["PageIsDiff"] = true - ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireTribute"] = true userName := ctx.Repo.Owner.Name diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index c10162c7595..1253721d343 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -67,7 +67,6 @@ func getParentTreeFields(treePath string) (treeNames, treePaths []string) { func editFile(ctx *context.Context, isNewFile bool) { ctx.Data["PageIsEdit"] = true ctx.Data["IsNewFile"] = isNewFile - ctx.Data["RequireHighlightJS"] = true canCommit := renderCommitRights(ctx) treePath := cleanUploadFileName(ctx.Repo.TreePath) @@ -197,7 +196,6 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b ctx.Data["PageIsEdit"] = true ctx.Data["PageHasPosted"] = true ctx.Data["IsNewFile"] = isNewFile - ctx.Data["RequireHighlightJS"] = true ctx.Data["TreePath"] = form.TreePath ctx.Data["TreeNames"] = treeNames ctx.Data["TreePaths"] = treePaths diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index cf919e0c32e..d905c075e3c 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -794,7 +794,6 @@ func NewIssue(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.issues.new") ctx.Data["PageIsIssueList"] = true ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0 - ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireTribute"] = true ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes title := ctx.FormString("title") @@ -988,7 +987,6 @@ func NewIssuePost(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.issues.new") ctx.Data["PageIsIssueList"] = true ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0 - ctx.Data["RequireHighlightJS"] = true ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled upload.AddUploadContext(ctx, "comment") @@ -1177,7 +1175,6 @@ func ViewIssue(ctx *context.Context) { ctx.Data["IssueType"] = "all" } - ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireTribute"] = true ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(unit.TypeProjects) ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled diff --git a/routers/web/repo/patch.go b/routers/web/repo/patch.go index 2bb9dc11999..cd731337baa 100644 --- a/routers/web/repo/patch.go +++ b/routers/web/repo/patch.go @@ -24,8 +24,6 @@ const ( // NewDiffPatch render create patch page func NewDiffPatch(ctx *context.Context) { - ctx.Data["RequireHighlightJS"] = true - canCommit := renderCommitRights(ctx) ctx.Data["TreePath"] = "" @@ -54,7 +52,6 @@ func NewDiffPatchPost(ctx *context.Context) { if form.CommitChoice == frmCommitChoiceNewBranch { branchName = form.NewBranchName } - ctx.Data["RequireHighlightJS"] = true ctx.Data["TreePath"] = "" ctx.Data["BranchLink"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL() ctx.Data["FileContent"] = form.Content diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 6cda560f3ca..74028c316cd 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -743,7 +743,6 @@ func ViewPullFiles(ctx *context.Context) { setCompareContext(ctx, baseCommit, commit, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name) - ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireTribute"] = true if ctx.Data["Assignees"], err = models.GetRepoAssignees(ctx.Repo.Repository); err != nil { ctx.ServerError("GetAssignees", err) @@ -1050,7 +1049,6 @@ func CompareAndPullRequestPost(ctx *context.Context) { ctx.Data["IsDiffCompare"] = true ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["RequireTribute"] = true - ctx.Data["RequireHighlightJS"] = true ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled upload.AddUploadContext(ctx, "comment") diff --git a/routers/web/repo/search.go b/routers/web/repo/search.go index c230e88d2d9..8f141cb149a 100644 --- a/routers/web/repo/search.go +++ b/routers/web/repo/search.go @@ -47,7 +47,6 @@ func Search(ctx *context.Context) { ctx.Data["SourcePath"] = ctx.Repo.Repository.HTMLURL() ctx.Data["SearchResults"] = searchResults ctx.Data["SearchResultLanguages"] = searchResultLanguages - ctx.Data["RequireHighlightJS"] = true ctx.Data["PageIsViewCode"] = true pager := context.NewPagination(total, setting.UI.RepoSearchPagingNum, page, 5) diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go index 86f3754a8ed..d2e24611892 100644 --- a/routers/web/repo/webhook.go +++ b/routers/web/repo/webhook.go @@ -735,8 +735,6 @@ func PackagistHooksNewPost(ctx *context.Context) { } func checkWebhook(ctx *context.Context) (*orgRepoCtx, *webhook.Webhook) { - ctx.Data["RequireHighlightJS"] = true - orCtx, err := getOrgRepoCtx(ctx) if err != nil { ctx.ServerError("getOrgRepoCtx", err) diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go index 2dbd62d816b..8bdb6fbc031 100644 --- a/routers/web/repo/wiki.go +++ b/routers/web/repo/wiki.go @@ -189,7 +189,6 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) { ctx.Data["old_title"] = pageName ctx.Data["Title"] = pageName ctx.Data["title"] = pageName - ctx.Data["RequireHighlightJS"] = true isSideBar := pageName == "_Sidebar" isFooter := pageName == "_Footer" @@ -308,7 +307,6 @@ func renderRevisionPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) ctx.Data["old_title"] = pageName ctx.Data["Title"] = pageName ctx.Data["title"] = pageName - ctx.Data["RequireHighlightJS"] = true ctx.Data["Username"] = ctx.Repo.Owner.Name ctx.Data["Reponame"] = ctx.Repo.Repository.Name @@ -384,7 +382,6 @@ func renderEditPage(ctx *context.Context) { ctx.Data["old_title"] = pageName ctx.Data["Title"] = pageName ctx.Data["title"] = pageName - ctx.Data["RequireHighlightJS"] = true // lookup filename in wiki - get filecontent, gitTree entry , real filename data, entry, _, noEntry := wikiContentsByName(ctx, commit, pageName)