diff options
-rw-r--r-- | docs/content/doc/advanced/customizing-gitea.en-us.md | 17 | ||||
-rw-r--r-- | routers/web/explore/code.go | 1 | ||||
-rw-r--r-- | routers/web/repo/cherry_pick.go | 3 | ||||
-rw-r--r-- | routers/web/repo/commit.go | 1 | ||||
-rw-r--r-- | routers/web/repo/editor.go | 2 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 3 | ||||
-rw-r--r-- | routers/web/repo/patch.go | 3 | ||||
-rw-r--r-- | routers/web/repo/pull.go | 2 | ||||
-rw-r--r-- | routers/web/repo/search.go | 1 | ||||
-rw-r--r-- | routers/web/repo/webhook.go | 2 | ||||
-rw-r--r-- | 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 1a8386fc3e..ef798ddbf9 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}} -<script src="https://your-server.com/deflate.js"></script> -<script src="https://your-server.com/encode.js"></script> -<script src="https://your-server.com/plantuml_codeblock_parse.js"></script> <script> - <!-- Replace call with address to your plantuml server--> - parsePlantumlCodeBlocks("http://www.plantuml.com/plantuml"); + $(async () => { + if (!$('.language-plantuml').length) return; + await Promise.all([ + $.getScript('https://your-server.com/deflate.js'), + $.getScript('https://your-server.com/encode.js'), + $.getScript('https://your-server.com/plantuml_codeblock_parse.js'), + ]); + // Replace call with address to your plantuml server + parsePlantumlCodeBlocks("https://www.plantuml.com/plantuml"); + }); </script> -{{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 28bdc7c9ca..41ca27782f 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 6667d27410..d2a4e19d0e 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 59d818672a..7f68fd3dd1 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 c10162c759..1253721d34 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 cf919e0c32..d905c075e3 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 2bb9dc1199..cd731337ba 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 6cda560f3c..74028c316c 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 c230e88d2d..8f141cb149 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 86f3754a8e..d2e2461189 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 2dbd62d816..8bdb6fbc03 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) |