From: Noah Campbell Date: Tue, 1 Oct 2013 19:51:00 +0000 (-0700) Subject: Set the name of the Nav attribute to select X-Git-Tag: v0.9~68 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=03d1a57fea650c13f7ca05481f5c84ffabeb2757;p=brevno-suite%2Fhugo Set the name of the Nav attribute to select --- diff --git a/transform/nav.go b/transform/nav.go index c3dfe790..b085c39a 100644 --- a/transform/nav.go +++ b/transform/nav.go @@ -8,6 +8,7 @@ import ( type NavActive struct { Section string + AttrName string } func (n *NavActive) Apply(r io.Reader, w io.Writer) (err error) { @@ -22,7 +23,11 @@ func (n *NavActive) Apply(r io.Reader, w io.Writer) (err error) { return } - tr.Apply(htmltran.ModifyAttrib("class", "active"), fmt.Sprintf("li[data-nav=%s]", n.Section)) + if n.AttrName == "" { + n.AttrName = "hugo-nav" + } + + tr.Apply(htmltran.ModifyAttrib("class", "active"), fmt.Sprintf("li[%s=%s]", n.AttrName, n.Section)) return tr.Render(w) } diff --git a/transform/nav_test.go b/transform/nav_test.go index 997fe33f..78e00f7d 100644 --- a/transform/nav_test.go +++ b/transform/nav_test.go @@ -12,8 +12,8 @@ const HTML_WITH_NAV = ` @@ -23,8 +23,8 @@ const EXPECTED_HTML_WITH_NAV_1 = `