Defect #11577 » anchors_with_transliteration.patch
| Gemfile (working copy) | ||
|---|---|---|
|
gem "coderay", "~> 1.0.6"
|
||
|
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
|
||
|
gem "builder"
|
||
|
gem "stringex"
|
||
|
# Optional gem for LDAP authentication
|
||
|
group :ldap do
|
||
| test/unit/helpers/application_helper_test.rb (working copy) | ||
|---|---|---|
|
'[[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>',
|
||
|
# UTF8 anchor
|
||
|
'[[Another_page#Тест|Тест]]' => %|<a href="/projects/ecookbook/wiki/Another_page##{CGI.escape 'Тест'}" class="wiki-page">Тест</a>|,
|
||
|
'[[Another_page#Тест|Тест]]' => %|<a href="/projects/ecookbook/wiki/Another_page#Tiest" class="wiki-page">Тест</a>|,
|
||
|
# page that doesn't exist
|
||
|
'[[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>',
|
||
| app/helpers/application_helper.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
def sanitize_anchor_name(anchor)
|
||
|
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
|
||
|
anchor.to_ascii.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
|
||
|
end
|
||
|
# Returns the javascript tags that are included in the html layout head
|
||