]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
navigation: Unexport menu entry methods
authorJoe Mooring <joe.mooring@veriphor.com>
Wed, 8 Nov 2023 04:23:45 +0000 (20:23 -0800)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 16 Nov 2023 17:22:31 +0000 (18:22 +0100)
- MenuEntry.IsEqual
- MenuEntry.IsSameResource

Closes #11670

navigation/menu.go
navigation/pagemenus.go

index a5b74b6fa6a2d3150348d7cedba6d4352ab656c4..50e51bcbee8b59718da73c3c8cbe59e02c6b9bb1 100644 (file)
@@ -124,14 +124,14 @@ func (m *MenuEntry) hopefullyUniqueID() string {
        }
 }
 
-// IsEqual returns whether the two menu entries represents the same menu entry.
-func (m *MenuEntry) IsEqual(inme *MenuEntry) bool {
+// isEqual returns whether the two menu entries represents the same menu entry.
+func (m *MenuEntry) isEqual(inme *MenuEntry) bool {
        return m.hopefullyUniqueID() == inme.hopefullyUniqueID() && m.Parent == inme.Parent
 }
 
-// IsSameResource returns whether the two menu entries points to the same
+// isSameResource returns whether the two menu entries points to the same
 // resource (URL).
-func (m *MenuEntry) IsSameResource(inme *MenuEntry) bool {
+func (m *MenuEntry) isSameResource(inme *MenuEntry) bool {
        if m.isSamePage(inme.Page) {
                return m.Page == inme.Page
        }
index 9c368f3ab42bf27b2ec08f535d0367566e6f62ae..6321a8a6316e243243e29e2cca4cf9694d936c29 100644 (file)
@@ -138,7 +138,7 @@ func (pm *pageMenus) HasMenuCurrent(menuID string, me *MenuEntry) bool {
 
        if m, ok := menus[menuID]; ok {
                for _, child := range me.Children {
-                       if child.IsEqual(m) {
+                       if child.isEqual(m) {
                                return true
                        }
                        if pm.HasMenuCurrent(menuID, child) {
@@ -168,7 +168,7 @@ func (pm *pageMenus) IsMenuCurrent(menuID string, inme *MenuEntry) bool {
        menus := pm.pagem.Menus()
 
        if me, ok := menus[menuID]; ok {
-               if me.IsEqual(inme) {
+               if me.isEqual(inme) {
                        return true
                }
        }
@@ -185,7 +185,7 @@ func (pm *pageMenus) IsMenuCurrent(menuID string, inme *MenuEntry) bool {
        // Search for it to make sure that it is in the menu with the given menuId.
        if menu, ok := pm.sitem.Menus()[menuID]; ok {
                for _, menuEntry := range menu {
-                       if menuEntry.IsSameResource(inme) {
+                       if menuEntry.isSameResource(inme) {
                                return true
                        }
 
@@ -203,7 +203,7 @@ func (pm *pageMenus) IsMenuCurrent(menuID string, inme *MenuEntry) bool {
 func (pm *pageMenus) isSameAsDescendantMenu(inme *MenuEntry, parent *MenuEntry) bool {
        if parent.HasChildren() {
                for _, child := range parent.Children {
-                       if child.IsSameResource(inme) {
+                       if child.isSameResource(inme) {
                                return true
                        }
                        descendantFound := pm.isSameAsDescendantMenu(inme, child)