1
0
Fork 0
forked from forgejo/forgejo

Improve Wiki TOC (#24137)

The old code has a lot of technical debts, eg: `repo/wiki/view.tmpl` /
`Iterate`

This PR improves the Wiki TOC display and improves the code.

---------

Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
wxiaoguang 2023-04-18 03:05:19 +08:00 committed by GitHub
parent f045e58cc7
commit 1ab16e48cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 129 additions and 118 deletions

View file

@ -60,7 +60,7 @@ func TestRenderConfig_UnmarshalYAML(t *testing.T) {
},
{
"toc", &RenderConfig{
TOC: true,
TOC: "true",
Meta: "table",
Icon: "table",
Lang: "",
@ -68,7 +68,7 @@ func TestRenderConfig_UnmarshalYAML(t *testing.T) {
},
{
"tocfalse", &RenderConfig{
TOC: false,
TOC: "false",
Meta: "table",
Icon: "table",
Lang: "",
@ -78,7 +78,7 @@ func TestRenderConfig_UnmarshalYAML(t *testing.T) {
"toclang", &RenderConfig{
Meta: "table",
Icon: "table",
TOC: true,
TOC: "true",
Lang: "testlang",
}, `
include_toc: true
@ -120,7 +120,7 @@ func TestRenderConfig_UnmarshalYAML(t *testing.T) {
"complex2", &RenderConfig{
Lang: "two",
Meta: "table",
TOC: true,
TOC: "true",
Icon: "smiley",
}, `
lang: one
@ -155,7 +155,7 @@ func TestRenderConfig_UnmarshalYAML(t *testing.T) {
t.Errorf("Lang Expected %s Got %s", tt.expected.Lang, got.Lang)
}
if got.TOC != tt.expected.TOC {
t.Errorf("TOC Expected %t Got %t", tt.expected.TOC, got.TOC)
t.Errorf("TOC Expected %q Got %q", tt.expected.TOC, got.TOC)
}
})
}