diff options
author | Etienne Massip <etienne.massip@gmail.com> | 2011-10-02 15:57:17 +0000 |
---|---|---|
committer | Etienne Massip <etienne.massip@gmail.com> | 2011-10-02 15:57:17 +0000 |
commit | 8bb90f87fb73e2f21a45ba213c59f31a93311b78 (patch) | |
tree | d732b501c9cd3b7bf4d858e0307ccacf7369dbbb /app/helpers | |
parent | ac2dbde135f7a63c4d57c6a7d0d07fff53f0d3ee (diff) | |
download | redmine-8bb90f87fb73e2f21a45ba213c59f31a93311b78.tar.gz redmine-8bb90f87fb73e2f21a45ba213c59f31a93311b78.zip |
Prepend page title to anchor in single page wiki HTML export to make links more unique.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7562 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4f3316224..eb29829b2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -577,7 +577,7 @@ module ApplicationHelper else case options[:wiki_links] when :local; "#{page.present? ? Wiki.titleize(page) : ''}.html" + (anchor.present? ? "##{anchor}" : '') - when :anchor; "##{title}" # used for single-file wiki export + when :anchor; "##{page.present? ? Wiki.titleize(page) : title}" + (anchor.present? ? "_#{anchor}" : '') # used for single-file wiki export else wiki_page_id = page.present? ? Wiki.titleize(page) : nil url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, :id => wiki_page_id, :anchor => anchor) @@ -728,6 +728,8 @@ module ApplicationHelper level, attrs, content = $1.to_i, $2, $3 item = strip_tags(content).strip anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-') + # used for single-file wiki export + anchor = "#{obj.page.title}_#{anchor}" if options[:wiki_links] == :anchor && (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) @parsed_headings << [level, anchor, item] "<a name=\"#{anchor}\"></a>\n<h#{level} #{attrs}>#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">¶</a></h#{level}>" end |