diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/port/gemini.go | 11 | ||||
-rw-r--r-- | internal/port/gopher.go | 9 |
2 files changed, 7 insertions, 13 deletions
diff --git a/internal/port/gemini.go b/internal/port/gemini.go index 2695214..f574816 100644 --- a/internal/port/gemini.go +++ b/internal/port/gemini.go | |||
@@ -49,21 +49,18 @@ func urlToGeminiNav(url string) (items []GeminiNavItem) { | |||
49 | parts = parts[:len(parts)-1] | 49 | parts = parts[:len(parts)-1] |
50 | } | 50 | } |
51 | 51 | ||
52 | for i, part := range parts { | 52 | for _, part := range parts { |
53 | partialURL = partialURL + "/" + part | 53 | partialURL = partialURL + "/" + part |
54 | 54 | ||
55 | current := false | ||
56 | if i == len(parts)-1 { | ||
57 | current = true | ||
58 | } | ||
59 | |||
60 | items = append(items, GeminiNavItem{ | 55 | items = append(items, GeminiNavItem{ |
61 | Label: part, | 56 | Label: part, |
62 | URL: partialURL, | 57 | URL: partialURL, |
63 | Current: current, | 58 | Current: false, |
64 | }) | 59 | }) |
65 | } | 60 | } |
66 | 61 | ||
62 | items[len(items)-1].Current = true | ||
63 | |||
67 | return | 64 | return |
68 | } | 65 | } |
69 | 66 | ||
diff --git a/internal/port/gopher.go b/internal/port/gopher.go index cb5e60c..fc7b754 100644 --- a/internal/port/gopher.go +++ b/internal/port/gopher.go | |||
@@ -69,18 +69,15 @@ func urlToGopherNav(url string) (items []GopherNavItem) { | |||
69 | partialURL = partialURL + "/" + part | 69 | partialURL = partialURL + "/" + part |
70 | } | 70 | } |
71 | 71 | ||
72 | current := false | ||
73 | if i == len(parts)-1 || (len(parts) == 2 && i == 0) { | ||
74 | current = true | ||
75 | } | ||
76 | |||
77 | items = append(items, GopherNavItem{ | 72 | items = append(items, GopherNavItem{ |
78 | Label: part, | 73 | Label: part, |
79 | URL: partialURL, | 74 | URL: partialURL, |
80 | Current: current, | 75 | Current: false, |
81 | }) | 76 | }) |
82 | } | 77 | } |
83 | 78 | ||
79 | items[len(items)-1].Current = true | ||
80 | |||
84 | return | 81 | return |
85 | } | 82 | } |
86 | 83 | ||