]> source.dussan.org Git - redmine.git/commitdiff
Allow to link to an anchor of the current wiki page (#16313).
authorGo MAEDA <maeda@farend.jp>
Sun, 20 May 2018 23:52:46 +0000 (23:52 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 20 May 2018 23:52:46 +0000 (23:52 +0000)
Patch by Holger Just.

git-svn-id: http://svn.redmine.org/redmine/trunk@17345 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index 48794aa95c68c4e09d59487532a2aa6ab51cc79d..dd152f32ce33a38098151a58159cd57f388e7960 100644 (file)
@@ -740,6 +740,12 @@ module ApplicationHelper
       link_project = project
       esc, all, page, title = $1, $2, $3, $5
       if esc.nil?
+        if page =~ /^\#(.+)$/
+          anchor = sanitize_anchor_name($1)
+          url = "##{anchor}"
+          next link_to(title.present? ? title.html_safe : h(page), url, :class => 'wiki-page')
+        end
+
         if page =~ /^([^\:]+)\:(.*)$/
           identifier, page = $1, $2
           link_project = Project.find_by_identifier(identifier) || Project.find_by_name(identifier)