##// END OF EJS Templates
Fixed: Can't use non-latin anchor in wiki (#11577)....
Jean-Philippe Lang -
r10023:3673fbd881c0
parent child
Show More
@@ -1157,7 +1157,12 module ApplicationHelper
1157 end
1157 end
1158
1158
1159 def sanitize_anchor_name(anchor)
1159 def sanitize_anchor_name(anchor)
1160 anchor.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
1160 if ''.respond_to?(:encoding)
1161 anchor.gsub(%r{[^\p{Word}\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
1162 else
1163 # TODO: remove when ruby1.8 is no longer supported
1164 anchor.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
1165 end
1161 end
1166 end
1162
1167
1163 # Returns the javascript tags that are included in the html layout head
1168 # Returns the javascript tags that are included in the html layout head
@@ -1,3 +1,5
1 # encoding: utf-8
2 #
1 # Redmine - project management software
3 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
4 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
5 #
@@ -526,6 +528,8 RAW
526 # link with anchor
528 # link with anchor
527 '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
529 '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
528 '[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>',
530 '[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>',
531 # UTF8 anchor
532 '[[Another_page#Тест|Тест]]' => %|<a href="/projects/ecookbook/wiki/Another_page##{CGI.escape 'Тест'}" class="wiki-page">Тест</a>|,
529 # page that doesn't exist
533 # page that doesn't exist
530 '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>',
534 '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>',
531 '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>',
535 '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>',
General Comments 0
You need to be logged in to leave comments. Login now