]> source.dussan.org Git - redmine.git/commitdiff
Don't escape already parsed wiki link title (#9471).
authorEtienne Massip <etienne.massip@gmail.com>
Sat, 29 Oct 2011 11:45:59 +0000 (11:45 +0000)
committerEtienne Massip <etienne.massip@gmail.com>
Sat, 29 Oct 2011 11:45:59 +0000 (11:45 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7698 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/unit/helpers/application_helper_test.rb

index c6d57ade9bc737de7a357cec06b468eefccc1af0..73d62ca77a4194136eb9d2049ad6c239209963d2 100644 (file)
@@ -592,7 +592,7 @@ module ApplicationHelper
               url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, :id => wiki_page_id, :anchor => anchor)
             end
           end
-          link_to(h(title || page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
+          link_to(title || h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
         else
           # project or wiki doesn't exist
           all.html_safe
index c87210155bac2556de9e9124d3832a2687122526..5806b7224cab6e503c3bdef5c1f27361d900f343 100644 (file)
@@ -350,6 +350,9 @@ RAW
     to_test = {
       '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>',
       '[[Another page|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a>',
+      # title content should be formatted
+      '[[Another page|With _styled_ *title*]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">With <em>styled</em> <strong>title</strong></a>',
+      '[[Another page|With title containing <strong>HTML entities &amp; markups</strong>]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">With title containing &lt;strong&gt;HTML entities &amp; markups&lt;/strong&gt;</a>',
       # link with anchor
       '[[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>',
@@ -371,6 +374,7 @@ RAW
       '[[unknowproject:Start]]' => '[[unknowproject:Start]]',
       '[[unknowproject:Start|Page title]]' => '[[unknowproject:Start|Page title]]',
     }
+
     @project = Project.find(1)
     to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
   end