summaryrefslogtreecommitdiffstats
path: root/hugolib/menu_test.go
AgeCommit message (Collapse)Author
2016-03-14hugolib: Remove unused codeBjørn Erik Pedersen
2016-03-10Fix for page in multiple menusBjørn Erik Pedersen
Fixes #1934
2016-02-07Add missing menu testsBjørn Erik Pedersen
2016-02-07Add menu sort testsBjørn Erik Pedersen
2016-02-06Fix buggy Menu.Limit()Bjørn Erik Pedersen
2016-01-14Add one more menu testBjørn Erik Pedersen
See #1774
2016-01-14Add menu test for external URLBjørn Erik Pedersen
See #1774
2015-12-10Add copyright header to that source files that don’t have one.Anthony Fok
See #1646
2015-12-06Remove transformation of menu URLsgunnaraasen
Fixes #1239
2015-07-14fix TestHomeNodeMenu testValere JEANTET
Signed-off-by: Valere JEANTET <valere.jeantet@gmail.com>
2015-06-21Fix map-order dependent menu testsBjørn Erik Pedersen
Fixes #1222
2015-06-21Print URL when failing menu testBjørn Erik Pedersen
See #1222
2015-06-21Comment out mystery testBjørn Erik Pedersen
Fails on Travis in Go 1.3 + 1.5. Will have to look into that one.
2015-06-12Revert "Add some debug to failing menu test"bep
This reverts commit becc627e1e55f08e04892212350fa4db72f5c43a.
2015-06-11Add some debug to failing menu testbep
2015-06-11Move Viper reset to correct level in menu testsbep
2015-06-11Reset Viper for every duplicate menu test iterationbep
2015-05-28Support `Fish and Chips` sectionbep
Section names are also used as the title of the list pages, but naming section folders as `Fish and Chips` and similar didn't work very well. This commit fixes that. This commit also changes the title casing of the section titles. Some may argue that this is a breaking change, but the old behaviour was also pretty broken, even for languages that use title capitalizations, as it didn't follow any particular style guide, `fish and chips` became `Fish And Chips` etc. Now it just turns the first letter into upper case, so `Fish and Chips` will be left as `Fish and Chips`. People wanting the good old behaviour can use the `title` template func. Fixes #1176
2015-05-20Stop Viper from leaking across many of the tests (now tests pass regardless ↵spf13
of order tested)
2015-05-09Fix IsMenuCurrent for SectionPagesMenubep
Pretty sure it has worked at some point, but that PR probably has been rebased to pieces. This refactors the fix by @dannys42 into a method, as this URL fix is applied several places. Fixes #1114
2015-05-08Section menu for the lazy bloggerbep
The current menu system works great, but is too much work if all you want is a simple menu with the sections as menu items, and having these menu items connected to the pages in a way that enables setting the correct menu item as active for both the section lists and the pages itself. This commit adds a new option `SectionPagesMenu' which, if set, will create a new menu with that name with all the sections as menu items. The pages in the sections will behave as "shadow members" of these section items as `blogpage.HasMenuCurrent "sectionmenu" $sectionmenuitem` will return true. If a menu item with the same `identifier` is defined in site config, *that* item will take precedence.
2015-04-18Remove unused types Shortcode and ShortcodeFuncbep
2015-03-18More initialism corrections (golint)Anthony Fok
Thanks to @bep's new, brilliant helpers.Deprecated() function, the following functions or variables are transitioned to their new names, preserving backward compatibility for v0.14 and warning the user of upcoming obsolescence in v0.15: * .Url → .URL (for node, menu and paginator) * .Site.BaseUrl → .Site.BaseURL * .Site.Indexes → .Site.Taxonomies * .Site.Recent → .Site.Pages * getJson → getJSON * getCsv → getCSV * safeHtml → safeHTML * safeCss → safeCSS * safeUrl → safeURL Also fix related initialisms in strings and comments. Continued effort in fixing #959.
2015-03-11Correct initialisms as suggested by golintAnthony Fok
First step to use initialisms that golint suggests, for example: Line 116: func GetHtmlRenderer should be GetHTMLRenderer as see on http://goreportcard.com/report/spf13/hugo Thanks to @bep for the idea! Note that command-line flags (cobra and pflag) as well as struct fields like .BaseUrl and .Url that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit. First step in fixing #959.
2015-03-07menu: make receiver name on Page methods consistentbep
Apply some Golint rules on Menu, esp. making the method receiver names consistent.
2015-02-10Make # survice Url cleaningbep
To enable anchors in Urls. Fixes #888
2015-01-26Move s.prepUrl() before prepending BaseUrl.Jonathan Anderson
When we have an absolute menu url specified in the config file (e.g., `menu: { main: { name: "News", url: "/news" } }`), its menu entry is generated by prefixing it with the BaseUrl. The result is then run through prepUrl(), which uses helpers.Urlize to convert urls such as 'My First Link' to 'my-first-link'. The behaviour is backwards: we do not want to run helpers.Urlize on the BaseUrl, only on the absolute component. Currently, a BaseUrl such as 'http://my.edu/ENG101' will be converted to 'http://my.edu/eng101', resulting in broken links in all of my menus. This commit switches the URL prep and BaseUrl prepending actions around. I would argue that these URLs shouldn't be run through prepUrl anyway because the site developer has specified them explicitly in a config file and might be surprised for, e.g., URLs to change case, but that's another commit for another time.
2015-01-23Fix RelPermalink() and Urls in menus vs canonifyUrlsbep
canonifyUrls=true, RelPermalink and baseUrl with sub-path did not work. This fixes that by adding a check for canonifyUrl=trues=true in RelPermalink(). So given - baseUrl "http://somehost.com/sub/" - the path "some-path/file.html" For canonifyUrls=false RelPermalink() returns "/sub/some-path/file.html" For canonifyUrls=true RelPermalink() returns "/some-path/file.html" In the last case, the Url will be made absolute and clickable in a later step. This commit also makes the menu urls defined in site config releative. To make them work with canonifying of urls, the context root is prepended if canonifying is turned off. Fixes #519 Fixes #711
2015-01-22Add menu tests for pages with both Yaml and Toml front matterbep
See #817
2015-01-01Revert "Temporarily disable failing menu test"bep
This reverts commit e4a22255ccb818f8b55a20f56ddcfda869db250f.
2014-12-26Fix unicode menu URLsbep
Menu urls like /categories/новости-проекта would turn into /categories/d0bdd0bed0b2d0bed181d182d0b8-d0bfd180d0bed0b5d0bad182d0b0, which is illegal, while the directory under the categories/ is created with the original name. It results in 404 not found error. This commit fixes that by make sure that SanitizeUrl() is called last. Fixes #719
2014-12-26Temporarily disable failing menu testbep
2014-12-11Revert "Make Urls in menus respect CanonifyUrls"bep
This reverts commit 3ccb3979028aafb3e6cc16d47daa77a1fdea11fa.
2014-12-10Make Urls in menus respect CanonifyUrlsbep
Fixes #519
2014-11-04Updating tests to use new Targets & Writers and switch to using ↵spf13
Afero.MemMapFs for more accurate tests.
2014-11-03Update menu test to work with revised source structspf13
2014-11-01Implement HasMenuCurrent and IsMenuCurrent for Nodesbep
Prior to this commit, `HasMenuCurrent` and `IsMenuCurrent` on `Node` always returned false. This made it hard (if possible at all) to mark the currently selected menu item/group for non-Page content (home page, category pages etc.), i.e. for menus defined in the site configuration. This commit provides an implementation of these two methods. Notable design choices: * These menu items have a loose coupling to the the resources they navigate to; the `Url` is the best common identificator. To facilitate a consistent matching, and to get it in line with the menu items connected to `Page`, relative Urls (Urls starting with '/') for menu items in the site configuration are converted to permaLinks using the same rules used for others’. * `IsMenuCurrent` only looks at the children of the current node; this is in line with the implementation on `Page`. * Due to this loose coupling, `IsMenuCurrent` have to search downards in the tree to make sure that the node is inside the current menu. This could have been made simpler if it could answer `yes` to any match of any menu item matching the current resource. This commit also adds a set of unit tests for the menu system. Fixes #367