From 1ab16e48cccc086e7f97fb3ae8a293fe47a3a452 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 18 Apr 2023 03:05:19 +0800 Subject: 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 --- templates/repo/wiki/view.tmpl | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'templates/repo') diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index a1d1c04751..318006d96e 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -65,28 +65,16 @@

{{.FormatWarning}}

{{end}} -
-
+
+
{{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} {{.content | Safe}}
- {{if or .sidebarPresent .toc}} -
- {{if .toc}} + {{if or .sidebarPresent .sidebarTocContent}} +
+ {{if .sidebarTocContent}}
-
- -
{{.locale.Tr "toc"}}
-
- {{$level := 0}} - {{range .toc}} - {{if lt $level .Level}}{{range Iterate (Eval .Level "-" $level)}}
    {{end}}{{end}} - {{if gt $level .Level}}{{range Iterate (Eval $level "-" .Level)}}
{{end}}{{end}} - {{$level = .Level}} -
  • {{.Text}}
  • - {{end}} - {{range Iterate $level}}{{end}} -
    + {{.sidebarTocContent | Safe}}
    {{end}} {{if .sidebarPresent}} -- cgit v1.2.3