Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tidying up html output

  • Loading branch information...
commit d58e6d9e9f7fad2710cd862f8215a7e4c1b76515 1 parent 665059a
Dirk Kelly authored
Showing with 13 additions and 6 deletions.
  1. +11 −4 lib/navigation/tags/core.rb
  2. +2 −2 lib/navigation/tags/helpers.rb
View
15 lib/navigation/tags/core.rb
@@ -40,8 +40,8 @@ class NavTagError < StandardError; end
css_class = [("current" if tag.locals.page == root), "first"].compact
first_set = true
- tree << %{<li class="#{css_class.join(' ') unless css_class.empty?}" id="#{(root.slug == '/' ? 'home' : root.slug) if tag.attr['ids_for_lis']}">}
- tree << %{<a href="#{root.url}" id="link_#{(child_page.slug == '/' ? 'home' : root.slug) if tag.attr['ids_for_links']}">}
+ tree << %{<li#{" class='#{css_class.join(' ')}'" unless css_class.empty?}#{" id='#{(root.slug == '/' ? 'home' : root.slug)}'" if tag.attr['ids_for_lis']}>}
+ tree << %{<a href="#{root.url}"#{" id='link_#{(child_page.slug == '/' ? 'home' : root.slug)}'" if tag.attr['ids_for_links']}>}
tree << %{#{root.breadcrumb}}
tree << %{</a></li>}
end
@@ -53,6 +53,13 @@ class NavTagError < StandardError; end
end
end
+ ['only','except','expand_all','include_root'].each do |key| #'root','depth'
+ tag.attr.delete(key)
+ end
+
+ tag.attr.delete('only')
+ tag.attr.delete('except')
+
if tag.attr
html_options = tag.attr.stringify_keys
tag_options = tag_options(html_options)
@@ -60,9 +67,9 @@ class NavTagError < StandardError; end
tag_options = nil
end
- %{<ul#{tag_options}>
+ %{<ol#{tag_options}>
#{tree}
- </ul>}
+ </ol>}
end
View
4 lib/navigation/tags/helpers.rb
@@ -19,8 +19,8 @@ def sub_nav(tag, child_page, depth, first_set = false)
css_class << "parent_of_current" if current_page.url.starts_with?(child_page.url) and current_page != child_page
css_class.compact!
- r = %{<li class="#{css_class.join(' ') unless css_class.empty?}" id="nav_#{child_page.slug if tag.attr['ids_for_lis']}">}
- r << %{<a href="#{child_page.url}" id="link_#{(child_page.slug == '/' ? 'home' : child_page.slug) if tag.attr['ids_for_links']}">}
+ r = %{<li#{" class='#{css_class.join(' ')}'" unless css_class.empty?}#{" id='nav_#{child_page.slug}'" if tag.attr['ids_for_lis']}>}
+ r << %{<a href="#{child_page.url}"#{" id='link_#{(child_page.slug == '/' ? 'home' : child_page.slug)}'" if tag.attr['ids_for_links']}>}
r << %{#{child_page.breadcrumb}}
r << %{</a>}
Please sign in to comment.
Something went wrong with that request. Please try again.