From 43c8d85f19e14e695eb129a8ff71bd106430b016 Mon Sep 17 00:00:00 2001
From: silverwind
Date: Mon, 3 Mar 2025 07:03:42 +0100
Subject: [PATCH 01/12] Disable `vet` as part of `go test` (#33662)
`go vet` implicitely runs as part of `go test`, but we already have
`make lint-go-vet`, so we were essentially running it twice. This should
hopefully make `go test` slightly faster.
Ref: https://pkg.go.dev/cmd/go#hdr-Test_packages
> As part of building a test binary, go test runs go vet
---
.github/workflows/pull-compliance.yml | 2 +-
Makefile | 11 ++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml
index 7e988e04492..64090d64905 100644
--- a/.github/workflows/pull-compliance.yml
+++ b/.github/workflows/pull-compliance.yml
@@ -95,7 +95,7 @@ jobs:
go-version-file: go.mod
check-latest: true
- run: make deps-backend deps-tools
- - run: make lint-go-windows lint-go-vet
+ - run: make lint-go-windows lint-go-gitea-vet
env:
TAGS: bindata sqlite sqlite_unlock_notify
GOOS: windows
diff --git a/Makefile b/Makefile
index d4b416156fe..0cc92697710 100644
--- a/Makefile
+++ b/Makefile
@@ -73,6 +73,7 @@ EXTRA_GOFLAGS ?=
MAKE_VERSION := $(shell "$(MAKE)" -v | cat | head -n 1)
MAKE_EVIDENCE_DIR := .make_evidence
+GOTESTFLAGS ?= -vet=off
ifeq ($(RACE_ENABLED),true)
GOFLAGS += -race
GOTESTFLAGS += -race
@@ -311,10 +312,10 @@ lint-frontend: lint-js lint-css ## lint frontend files
lint-frontend-fix: lint-js-fix lint-css-fix ## lint frontend files and fix issues
.PHONY: lint-backend
-lint-backend: lint-go lint-go-vet lint-go-gopls lint-editorconfig ## lint backend files
+lint-backend: lint-go lint-go-gitea-vet lint-go-gopls lint-editorconfig ## lint backend files
.PHONY: lint-backend-fix
-lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig ## lint backend files and fix issues
+lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backend files and fix issues
.PHONY: lint-js
lint-js: node_modules ## lint js files
@@ -365,9 +366,9 @@ lint-go-windows:
@GOOS= GOARCH= $(GO) install $(GOLANGCI_LINT_PACKAGE)
golangci-lint run
-.PHONY: lint-go-vet
-lint-go-vet: ## lint go files with vet
- @echo "Running go vet..."
+.PHONY: lint-go-gitea-vet
+lint-go-gitea-vet: ## lint go files with gitea-vet
+ @echo "Running gitea-vet..."
@GOOS= GOARCH= $(GO) build code.gitea.io/gitea-vet
@$(GO) vet -vettool=gitea-vet ./...
From f0f1737d4d533e06f482a63ff995ae79cc1c89dc Mon Sep 17 00:00:00 2001
From: Kerwin Bryant
Date: Tue, 4 Mar 2025 03:49:15 +0800
Subject: [PATCH 02/12] Refactor markup and pdf-viewer to use new init
framework (#33772)
1. Add some "render-content" classes to "markup" elements when the
content is rendered
2. Use correct "markup" wrapper for "preview" (but not set that class on
the tab)
3. Remove incorrect "markup" class from LFS file view, because there is
no markup content
* "edit-diff" is also removed because it does nothing
5. Use "initPdfViewer" for PDF viewer
6. Remove incorrect "content" class from milestone markup
7. Init all ".markup" elements by new init framework
---------
Co-authored-by: wxiaoguang
---
templates/org/home.tmpl | 2 +-
templates/projects/list.tmpl | 4 +-
templates/repo/editor/edit.tmpl | 4 +-
templates/repo/issue/fields/markdown.tmpl | 2 +-
templates/repo/issue/milestone_issues.tmpl | 2 +-
templates/repo/issue/milestones.tmpl | 4 +-
templates/repo/release/list.tmpl | 2 +-
templates/repo/settings/lfs_file.tmpl | 4 +-
templates/repo/view_file.tmpl | 2 +-
templates/repo/wiki/view.tmpl | 8 +-
templates/shared/combomarkdowneditor.tmpl | 2 +-
templates/user/dashboard/feeds.tmpl | 2 +-
templates/user/dashboard/milestones.tmpl | 6 +-
templates/user/profile.tmpl | 2 +-
web_src/css/editor/fileeditor.css | 9 --
web_src/css/markup/content.css | 2 +-
web_src/css/shared/milestone.css | 2 +-
web_src/js/features/repo-editor.ts | 4 +-
web_src/js/features/repo-issue-edit.ts | 3 -
web_src/js/features/repo-wiki.ts | 4 +-
web_src/js/index.ts | 3 +-
web_src/js/markup/asciicast.ts | 18 ++-
web_src/js/markup/codecopy.ts | 17 ++-
web_src/js/markup/content.ts | 25 ++--
web_src/js/markup/math.ts | 42 ++++---
web_src/js/markup/mermaid.ts | 108 +++++++++---------
web_src/js/markup/tasklist.ts | 126 ++++++++++-----------
web_src/js/modules/observer.ts | 3 +
web_src/js/render/pdf.ts | 10 +-
29 files changed, 195 insertions(+), 227 deletions(-)
diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl
index 826642db42c..cffdfabfaa9 100644
--- a/templates/org/home.tmpl
+++ b/templates/org/home.tmpl
@@ -6,7 +6,7 @@
{{if .ProfileReadmeContent}}
-
{{.ProfileReadmeContent}}
+
{{.ProfileReadmeContent}}
{{end}}
{{template "shared/repo_search" .}}
{{template "explore/repo_list" .}}
diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl
index 5d40653dc67..48083811e76 100644
--- a/templates/projects/list.tmpl
+++ b/templates/projects/list.tmpl
@@ -74,9 +74,7 @@
{{end}}
{{if .Description}}
-
- {{.RenderedContent}}
-
+
{{.RenderedContent}}
{{end}}
{{end}}
diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl
index 577a2be9ad3..ae8a60c20c1 100644
--- a/templates/repo/editor/edit.tmpl
+++ b/templates/repo/editor/edit.tmpl
@@ -45,10 +45,10 @@
data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}
-
+
{{ctx.Locale.Tr "loading"}}
-
diff --git a/templates/repo/issue/fields/markdown.tmpl b/templates/repo/issue/fields/markdown.tmpl
index da8f5e6bdf7..dbf4b71ba8a 100644
--- a/templates/repo/issue/fields/markdown.tmpl
+++ b/templates/repo/issue/fields/markdown.tmpl
@@ -1,3 +1,3 @@
diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl
index abb4e3290da..ac5d7f16ddd 100644
--- a/templates/repo/issue/milestone_issues.tmpl
+++ b/templates/repo/issue/milestone_issues.tmpl
@@ -22,7 +22,7 @@
{{end}}
{{if .Milestone.RenderedContent}}
-
+
{{.Milestone.RenderedContent}}
{{end}}
diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl
index e7dfe08ee05..5701c1faa60 100644
--- a/templates/repo/issue/milestones.tmpl
+++ b/templates/repo/issue/milestones.tmpl
@@ -81,9 +81,7 @@
{{end}}
{{if .Content}}
-
- {{.RenderedContent}}
-
+ {{.RenderedContent}}
{{end}}
{{end}}
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 041890ca9cd..88bd85ef4db 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -64,7 +64,7 @@
| {{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind}} {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}
{{end}}
-
+
{{$release.RenderedNote}}
diff --git a/templates/repo/settings/lfs_file.tmpl b/templates/repo/settings/lfs_file.tmpl
index f6fac05b691..9f72d764ae9 100644
--- a/templates/repo/settings/lfs_file.tmpl
+++ b/templates/repo/settings/lfs_file.tmpl
@@ -13,7 +13,7 @@
{{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}}
-
+
{{if .IsFileTooLarge}}
{{template "shared/filetoolarge" dict "RawFileLink" .RawFileLink}}
{{else if not .FileSize}}
@@ -31,7 +31,7 @@
{{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}}
{{else if .IsPDFFile}}
-
+
{{else}}
{{ctx.Locale.Tr "repo.file_view_raw"}}
{{end}}
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index 4907d87301f..9f1b2a5e8f4 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -108,7 +108,7 @@
{{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}}
{{else if .IsPDFFile}}
-
+
{{else}}
{{ctx.Locale.Tr "repo.file_view_raw"}}
{{end}}
diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl
index 843a977e3e5..efb614280a5 100644
--- a/templates/repo/wiki/view.tmpl
+++ b/templates/repo/wiki/view.tmpl
@@ -63,18 +63,18 @@
{{if .sidebarTocContent}}
-