github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/website/helpers/sidebar_helpers.rb (about)

     1  module SidebarHelpers
     2    # This helps by setting the "active" class for sidebar nav elements
     3    # if the YAML frontmatter matches the expected value.
     4    def sidebar_current(expected)
     5      current = current_page.data.sidebar_current || ""
     6      if current == expected or (expected.is_a?(Regexp) and expected.match(current))
     7        return " class=\"active\""
     8      else
     9        return ""
    10      end
    11    end
    12  end