Fixed: Can't use non-latin anchor in wiki (#11577).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10206 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d79bcc4369
commit
3673fbd881
@ -1157,7 +1157,12 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def sanitize_anchor_name(anchor)
|
def sanitize_anchor_name(anchor)
|
||||||
anchor.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
|
if ''.respond_to?(:encoding)
|
||||||
|
anchor.gsub(%r{[^\p{Word}\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
|
||||||
|
else
|
||||||
|
# TODO: remove when ruby1.8 is no longer supported
|
||||||
|
anchor.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the javascript tags that are included in the html layout head
|
# Returns the javascript tags that are included in the html layout head
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
#
|
||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
@ -526,6 +528,8 @@ RAW
|
|||||||
# link with anchor
|
# link with anchor
|
||||||
'[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
|
'[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
|
||||||
'[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>',
|
'[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>',
|
||||||
|
# UTF8 anchor
|
||||||
|
'[[Another_page#Тест|Тест]]' => %|<a href="/projects/ecookbook/wiki/Another_page##{CGI.escape 'Тест'}" class="wiki-page">Тест</a>|,
|
||||||
# page that doesn't exist
|
# page that doesn't exist
|
||||||
'[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>',
|
'[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>',
|
||||||
'[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>',
|
'[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user