-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
type/proposalThe new feature has not been accepted yet but needs to be discussed first.The new feature has not been accepted yet but needs to be discussed first.type/refactoringExisting code has been cleaned up. There should be no new functionality.Existing code has been cleaned up. There should be no new functionality.type/summaryThis issue aggregates a bunch of other issuesThis issue aggregates a bunch of other issues
Description
Feature Description
Gitea is heavily using Go HTML Template, so it's worth to make the template system more maintainable.
There are some strange smells in template/helper.go
:
- Deadcode clean up
-
Dict
/dict
/mergeinto
: actually we can have only one unique "dict"(map) maintaining function. - Many calculation related functions like
Add
,Mul
,percentage
, etc, they could be replaced by a more genericEval
like:{{Eval "(" $a "+" $b ")" "/" 100}}
-
Printf
vsprintf
: only builtinprintf
is enough - Iterate: it seems a little complex (removed by Improve Wiki TOC #24137)
- More and more functions need to use
Context
, it's better to introduce a general helper map or struct, then old code{{RenderEmoji $.Context ...}}
could be improved to{{.CtxFunc.RenderEmoji ...}}
- After Drop "unrolled/render" package #23965
- We can have per-request context global functions.
- Make HTML template functions support context #24056
- [Proposal] Make Gitea template system support context function #24228
-
containGeneric
vscontain
: clarify their behavior
TODO:
- Use
"SettingUI": &setting.UI
to expose all UI settings to templates
ps: only do big refactoring after 1.19.0 or even 1.19.1 gets released, to prevent from making backport difficult.
delvh and lunnylunny
Metadata
Metadata
Assignees
Labels
type/proposalThe new feature has not been accepted yet but needs to be discussed first.The new feature has not been accepted yet but needs to be discussed first.type/refactoringExisting code has been cleaned up. There should be no new functionality.Existing code has been cleaned up. There should be no new functionality.type/summaryThis issue aggregates a bunch of other issuesThis issue aggregates a bunch of other issues