TOC rendered as an unordered list.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1693 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-07-22 19:40:47 +00:00
parent a17b62b455
commit 5564dfbbd5
3 changed files with 17 additions and 13 deletions

View File

@@ -81,16 +81,16 @@ module Redmine
div_class = 'toc'
div_class << ' right' if $1 == '>'
div_class << ' left' if $1 == '<'
out = "<div class=\"#{div_class}\">"
out = "<ul class=\"#{div_class}\">"
@toc.each_with_index do |heading, index|
# remove wiki links from the item
toc_item = heading.last.gsub(/(\[\[|\]\])/, '')
# remove styles
# eg. %{color:red}Triggers% => Triggers
toc_item.gsub! %r[%\{[^\}]*\}([^%]+)%], '\\1'
out << "<a href=\"##{index+1}\" class=\"heading#{heading.first}\">#{toc_item}</a>"
out << "<li class=\"heading#{heading.first}\"><a href=\"##{index+1}\">#{toc_item}</a></li>\n"
end
out << '</div>'
out << '</ul>'
out
end
end