Project

General

Profile

Feature #32424 » 0011-Render-markdown-attachments-using-markdown-or-common.patch

Marius BĂLTEANU, 2021-07-04 12:21

View differences:

app/helpers/application_helper.rb
)
end
# Returns the markdown formatter: markdown or common_mark
# ToDo: Remove this when markdown will be removed
def markdown_formatter
if Setting.text_formatting == "common_mark"
"common_mark"
else
"markdown"
end
end
private
def wiki_helper
app/helpers/attachments_helper.rb
def render_file_content(attachment, content)
if attachment.is_markdown?
render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => content}
render :partial => 'common/markup', :locals => {:markup_text_formatting => markdown_formatter, :markup_text => content}
elsif attachment.is_textile?
render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => content}
else
app/views/repositories/entry.html.erb
<% 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} %>
<%= render :partial => 'common/markup', :locals => {:markup_text_formatting => markdown_formatter, :markup_text => @content} %>
<% elsif @content %>
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
<% else %>
(10-10/26)