URI: 
       Fix permalink functionality, which was broken in 62dd1d4. - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 025a37df2f829a1799a2995ef8e49d591e96bee3
   DIR parent 05b76dcb6fb02fdaa7e8b99cd5cb123bdae8881e
  HTML Author: Dato Simó <dato@net.com.org.es>
       Date:   Sun, 11 May 2014 01:27:49 +0100
       
       Fix permalink functionality, which was broken in 62dd1d4.
       
       Viper stores Permalinks as a map[string]interface{}, so the type assertion
       to PermalinkOverrides (map[string]PathPattern) will always fail.
       
       We can, however, get Permalinks as a map[string]string, and convert each
       value to a PathPattern.
       
       Diffstat:
         M hugolib/site.go                     |       6 +++---
         M hugolib/siteinfo_test.go            |      12 ++++++++++++
       
       2 files changed, 15 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/hugolib/site.go b/hugolib/site.go
       @@ -265,9 +265,9 @@ func (s *Site) initializeSiteInfo() {
                        params = make(map[string]interface{})
                }
        
       -        permalinks, ok := viper.Get("Permalinks").(PermalinkOverrides)
       -        if !ok {
       -                permalinks = make(PermalinkOverrides)
       +        permalinks := make(PermalinkOverrides)
       +        for k, v := range viper.GetStringMapString("Permalinks") {
       +                permalinks[k] = PathPattern(v)
                }
        
                s.Info = SiteInfo{
   DIR diff --git a/hugolib/siteinfo_test.go b/hugolib/siteinfo_test.go
       @@ -30,3 +30,15 @@ func TestSiteInfoParams(t *testing.T) {
                        t.Errorf("Expected FOOBAR_PARAM: got %s", buf.String())
                }
        }
       +
       +func TestSiteInfoPermalinks (t *testing.T) {
       +        viper.Set("Permalinks", map[string]interface{}{"section": "/:title"})
       +        s := &Site{}
       +
       +        s.initialize()
       +        permalink := s.Info.Permalinks["section"]
       +
       +        if permalink != "/:title" {
       +                t.Errorf("Could not set permalink (%#v)", permalink)
       +        }
       +}