Skip to content

Commit 7807cd7

Browse files
committed
Remove RequireHighlightJS field, update plantuml example.
1 parent 5a75a54 commit 7807cd7

File tree

11 files changed

+10
-28
lines changed

11 files changed

+10
-28
lines changed

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,18 @@ copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highl
132132
`$GITEA_CUSTOM/public` folder. Then add the following to `custom/footer.tmpl`:
133133

134134
```html
135-
{{if .RequireHighlightJS}}
136-
<script src="https://your-server.com/deflate.js"></script>
137-
<script src="https://your-server.com/encode.js"></script>
138-
<script src="https://your-server.com/plantuml_codeblock_parse.js"></script>
139135
<script>
140-
<!-- Replace call with address to your plantuml server-->
141-
parsePlantumlCodeBlocks("http://www.plantuml.com/plantuml");
136+
$(async () => {
137+
if (!$('.language-plantuml').length) return;
138+
await Promise.all([
139+
$.getScript('https://your-server.com/deflate.js'),
140+
$.getScript('https://your-server.com/encode.js'),
141+
$.getScript('https://your-server.com/plantuml_codeblock_parse.js'),
142+
]);
143+
// Replace call with address to your plantuml server
144+
parsePlantumlCodeBlocks("https://www.plantuml.com/plantuml");
145+
});
142146
</script>
143-
{{end}}
144147
```
145148

146149
You can then add blocks like the following to your markdown:

routers/web/explore/code.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ func Code(ctx *context.Context) {
138138
ctx.Data["queryType"] = queryType
139139
ctx.Data["SearchResults"] = searchResults
140140
ctx.Data["SearchResultLanguages"] = searchResultLanguages
141-
ctx.Data["RequireHighlightJS"] = true
142141
ctx.Data["PageIsViewCode"] = true
143142

144143
pager := context.NewPagination(total, setting.UI.RepoSearchPagingNum, page, 5)

routers/web/repo/cherry_pick.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ func CherryPick(ctx *context.Context) {
4747
ctx.Data["commit_message"] = splits[1]
4848
}
4949

50-
ctx.Data["RequireHighlightJS"] = true
51-
5250
canCommit := renderCommitRights(ctx)
5351
ctx.Data["TreePath"] = ""
5452

@@ -77,7 +75,6 @@ func CherryPickPost(ctx *context.Context) {
7775
ctx.Data["CherryPickType"] = "cherry-pick"
7876
}
7977

80-
ctx.Data["RequireHighlightJS"] = true
8178
canCommit := renderCommitRights(ctx)
8279
branchName := ctx.Repo.BranchName
8380
if form.CommitChoice == frmCommitChoiceNewBranch {

routers/web/repo/commit.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ func FileHistory(ctx *context.Context) {
253253
// Diff show different from current commit to previous commit
254254
func Diff(ctx *context.Context) {
255255
ctx.Data["PageIsDiff"] = true
256-
ctx.Data["RequireHighlightJS"] = true
257256
ctx.Data["RequireTribute"] = true
258257

259258
userName := ctx.Repo.Owner.Name

routers/web/repo/editor.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func getParentTreeFields(treePath string) (treeNames, treePaths []string) {
6767
func editFile(ctx *context.Context, isNewFile bool) {
6868
ctx.Data["PageIsEdit"] = true
6969
ctx.Data["IsNewFile"] = isNewFile
70-
ctx.Data["RequireHighlightJS"] = true
7170
canCommit := renderCommitRights(ctx)
7271

7372
treePath := cleanUploadFileName(ctx.Repo.TreePath)
@@ -197,7 +196,6 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
197196
ctx.Data["PageIsEdit"] = true
198197
ctx.Data["PageHasPosted"] = true
199198
ctx.Data["IsNewFile"] = isNewFile
200-
ctx.Data["RequireHighlightJS"] = true
201199
ctx.Data["TreePath"] = form.TreePath
202200
ctx.Data["TreeNames"] = treeNames
203201
ctx.Data["TreePaths"] = treePaths

routers/web/repo/issue.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,6 @@ func NewIssue(ctx *context.Context) {
794794
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
795795
ctx.Data["PageIsIssueList"] = true
796796
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
797-
ctx.Data["RequireHighlightJS"] = true
798797
ctx.Data["RequireTribute"] = true
799798
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
800799
title := ctx.FormString("title")
@@ -988,7 +987,6 @@ func NewIssuePost(ctx *context.Context) {
988987
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
989988
ctx.Data["PageIsIssueList"] = true
990989
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
991-
ctx.Data["RequireHighlightJS"] = true
992990
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
993991
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
994992
upload.AddUploadContext(ctx, "comment")
@@ -1177,7 +1175,6 @@ func ViewIssue(ctx *context.Context) {
11771175
ctx.Data["IssueType"] = "all"
11781176
}
11791177

1180-
ctx.Data["RequireHighlightJS"] = true
11811178
ctx.Data["RequireTribute"] = true
11821179
ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanRead(unit.TypeProjects)
11831180
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled

routers/web/repo/patch.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ const (
2424

2525
// NewDiffPatch render create patch page
2626
func NewDiffPatch(ctx *context.Context) {
27-
ctx.Data["RequireHighlightJS"] = true
28-
2927
canCommit := renderCommitRights(ctx)
3028

3129
ctx.Data["TreePath"] = ""
@@ -54,7 +52,6 @@ func NewDiffPatchPost(ctx *context.Context) {
5452
if form.CommitChoice == frmCommitChoiceNewBranch {
5553
branchName = form.NewBranchName
5654
}
57-
ctx.Data["RequireHighlightJS"] = true
5855
ctx.Data["TreePath"] = ""
5956
ctx.Data["BranchLink"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
6057
ctx.Data["FileContent"] = form.Content

routers/web/repo/pull.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,6 @@ func ViewPullFiles(ctx *context.Context) {
743743

744744
setCompareContext(ctx, baseCommit, commit, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
745745

746-
ctx.Data["RequireHighlightJS"] = true
747746
ctx.Data["RequireTribute"] = true
748747
if ctx.Data["Assignees"], err = models.GetRepoAssignees(ctx.Repo.Repository); err != nil {
749748
ctx.ServerError("GetAssignees", err)
@@ -1050,7 +1049,6 @@ func CompareAndPullRequestPost(ctx *context.Context) {
10501049
ctx.Data["IsDiffCompare"] = true
10511050
ctx.Data["IsRepoToolbarCommits"] = true
10521051
ctx.Data["RequireTribute"] = true
1053-
ctx.Data["RequireHighlightJS"] = true
10541052
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
10551053
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
10561054
upload.AddUploadContext(ctx, "comment")

routers/web/repo/search.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func Search(ctx *context.Context) {
4747
ctx.Data["SourcePath"] = ctx.Repo.Repository.HTMLURL()
4848
ctx.Data["SearchResults"] = searchResults
4949
ctx.Data["SearchResultLanguages"] = searchResultLanguages
50-
ctx.Data["RequireHighlightJS"] = true
5150
ctx.Data["PageIsViewCode"] = true
5251

5352
pager := context.NewPagination(total, setting.UI.RepoSearchPagingNum, page, 5)

routers/web/repo/webhook.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,6 @@ func PackagistHooksNewPost(ctx *context.Context) {
735735
}
736736

737737
func checkWebhook(ctx *context.Context) (*orgRepoCtx, *webhook.Webhook) {
738-
ctx.Data["RequireHighlightJS"] = true
739-
740738
orCtx, err := getOrgRepoCtx(ctx)
741739
if err != nil {
742740
ctx.ServerError("getOrgRepoCtx", err)

routers/web/repo/wiki.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) {
189189
ctx.Data["old_title"] = pageName
190190
ctx.Data["Title"] = pageName
191191
ctx.Data["title"] = pageName
192-
ctx.Data["RequireHighlightJS"] = true
193192

194193
isSideBar := pageName == "_Sidebar"
195194
isFooter := pageName == "_Footer"
@@ -308,7 +307,6 @@ func renderRevisionPage(ctx *context.Context) (*git.Repository, *git.TreeEntry)
308307
ctx.Data["old_title"] = pageName
309308
ctx.Data["Title"] = pageName
310309
ctx.Data["title"] = pageName
311-
ctx.Data["RequireHighlightJS"] = true
312310
ctx.Data["Username"] = ctx.Repo.Owner.Name
313311
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
314312

@@ -384,7 +382,6 @@ func renderEditPage(ctx *context.Context) {
384382
ctx.Data["old_title"] = pageName
385383
ctx.Data["Title"] = pageName
386384
ctx.Data["title"] = pageName
387-
ctx.Data["RequireHighlightJS"] = true
388385

389386
// lookup filename in wiki - get filecontent, gitTree entry , real filename
390387
data, entry, _, noEntry := wikiContentsByName(ctx, commit, pageName)

0 commit comments

Comments
 (0)