diff --git a/app/views/repositories/entry.html.erb b/app/views/repositories/entry.html.erb index 2cc1a08593..4f8678beab 100644 --- a/app/views/repositories/entry.html.erb +++ b/app/views/repositories/entry.html.erb @@ -10,6 +10,10 @@ <% if Redmine::MimeType.is_type?('image', @path) %> <%= render :partial => 'common/image', :locals => {:path => @raw_url, :alt => @path} %> +<% elsif Redmine::MimeType.of(@path) == 'text/x-textile' %> + <%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => @content} %> +<% elsif Redmine::MimeType.of(@path) == 'text/markdown' %> + <%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => @content} %> <% elsif @content %> <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %> <% else %> diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index 6988d2a5d6..f6db7c0024 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -27,7 +27,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers PRJ_ID = 3 - NUM_REV = 12 + NUM_REV = 13 def setup super @@ -204,7 +204,8 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest ) assert_response :success assert_select 'table.changesets tbody' do - assert_select 'tr', 7 + assert_select 'tr', 8 + assert_select 'tr td.id a', :text => '13' assert_select 'tr td.id a', :text => '12' assert_select 'tr td.id a', :text => '10' assert_select 'tr td.id a', :text => '9' @@ -280,6 +281,32 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_select 'audio[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/chords.mp3" end + def text_entry_should_preview_markdown + get( + :entry, + :params => { + :id => PRJ_ID, + :repository_id => @repository.id, + :path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'testfile.md'])[:param] + } + ) + assert_response :success + assert_select 'div.wiki', :html => "

Header 1

\n\n

Header 2

\n\n

Header 3

" + end + + def text_entry_should_preview_textile + get( + :entry, + :params => { + :id => PRJ_ID, + :repository_id => @repository.id, + :path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'testfile.textile'])[:param] + } + ) + assert_response :success + assert_select 'div.wiki', :html => "

Header 1

\n\n\n\t

Header 2

\n\n\n\t

Header 3

" + end + def test_entry_at_given_revision assert_equal 0, @repository.changesets.count @repository.fetch_changesets