aboutsummaryrefslogtreecommitdiffstats
path: root/modules/context/private.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-04-23 01:28:20 +0800
committerGitHub <noreply@github.com>2023-04-22 13:28:20 -0400
commitc0d105609f120839c91679b0548b9438155c4bba (patch)
tree702f1746274047494b791de8826bbe6f4e074b33 /modules/context/private.go
parent3cc87370c3b4495edf9f31a9f96e2b6f34cbd35d (diff)
downloadgitea-c0d105609f120839c91679b0548b9438155c4bba.tar.gz
gitea-c0d105609f120839c91679b0548b9438155c4bba.zip
Add `DumpVar` helper function to help debugging templates (#24262)
I guess many contributors might agree that it's really difficult to write Golang template. The dot syntax `.` confuses everyone: what variable it is .... So, we can use a `{{DumpVar .ContextUser}}` to look into every variable now. ![image](https://user-images.githubusercontent.com/2114189/233692383-f3c8f24d-4465-45f8-839b-b63e00731559.png) And it can even dump the whole `ctx.Data` by `{{DumpVar .}}`: ``` dumpVar: templates.Vars { "AllLangs": [ { "Lang": "id-ID", "Name": "Bahasa Indonesia" }, ... "Context": "[dumped]", "ContextUser": { "AllowCreateOrganization": true, "AllowGitHook": false, "AllowImportLocal": false, ... "TemplateLoadTimes": "[func() string]", "TemplateName": "user/profile", "Title": "Full'\u003cspan\u003e Name", "Total": 7, "UnitActionsGlobalDisabled": false, "UnitIssuesGlobalDisabled": false, "UnitProjectsGlobalDisabled": false, "UnitPullsGlobalDisabled": false, "UnitWikiGlobalDisabled": false, "locale": { "Lang": "en-US", "LangName": "English", "Locale": {} } ... --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'modules/context/private.go')
0 files changed, 0 insertions, 0 deletions