From 29d8e3f3835cc7543c390a8a8f5bdfd67bcd3c2d Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Sat, 29 Apr 2023 11:48:34 -0700 Subject: refactor(indexHandler): Don't retain configuration (#86) Similar to the previous patch, this patch removes knowledge of the configuration from the index handler. Instead, the index handler is now passed a list of packageInfo structs each containing just the information needed to render the index page. This also obviates the need to duplicate the logic to compute the package import path in the index.html template. --- templates/index.html | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'templates') diff --git a/templates/index.html b/templates/index.html index d193263..fa061f1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -24,24 +24,20 @@
Source
Documentation
- {{ range $key, $value := .Packages }} - {{ $importPath := printf "%v/%v" $.URL $key }} - {{ if ne $value.URL "" }} - {{ $importPath = printf "%v/%v" $value.URL $key }} - {{ end }} + {{ range .Packages }}
Package: - {{ $importPath }} + {{ .ImportPath }}
-- cgit v1.2.3