Feature #44435 ยป 0001-Add-preview-support-for-Rich-Text-Format-.rtf-files.patch
| config/configuration.yml.example | ||
|---|---|---|
|
# - example.org
|
||
|
# - "*.example.com"
|
||
|
# Preview for Office documents (Microsoft Office / LibreOffice)
|
||
|
# Preview for Office documents (Microsoft Office / LibreOffice / RTF)
|
||
|
#
|
||
|
# Redmine uses Pandoc to convert supported Microsoft Office and LibreOffice
|
||
|
# attachments to Markdown for preview. The settings below named
|
||
|
# Redmine uses Pandoc to convert supported Microsoft Office, LibreOffice and
|
||
|
# Rich Text Format attachments to Markdown for preview. The settings below named
|
||
|
# `markdownized_preview_*` control that Markdown-based preview generation.
|
||
|
#
|
||
|
# Absolute path (e.g. /usr/local/bin/pandoc) to the Pandoc command
|
||
| doc/INSTALL | ||
|---|---|---|
|
available in PATH)
|
||
|
* ImageMagick (to enable thumbnail generation and Gantt export to PNG images)
|
||
|
* Ghostscript (to enable thumbnail generation for PDF attachments)
|
||
|
* Pandoc, to enable previews for Microsoft Office (.docx, .xlsx, .pptx) and
|
||
|
LibreOffice Writer (.odt) documents. Version 3.8.3 or later is recommended.
|
||
|
Older versions of Pandoc supports only .docx and .odt documents.
|
||
|
* Pandoc, to enable previews for Microsoft Office (.docx, .xlsx, .pptx),
|
||
|
LibreOffice Writer (.odt) and Rich Text Format (.rtf) documents.
|
||
|
Version 3.8.3 or later is recommended. Older versions of Pandoc supports
|
||
|
only .docx and .odt documents (.rtf requires 2.14.2 or later).
|
||
|
Supported browsers:
|
||
|
The current version of Firefox, Safari, Chrome, Chromium and Microsoft Edge.
|
||
| lib/redmine/markdownizer.rb | ||
|---|---|---|
|
else
|
||
|
return (@markdownizable_extensions = [])
|
||
|
end
|
||
|
# Pandoc >= 3.8.3 supports Microsoft Excel and PowerPoint files
|
||
|
# Formats that require a newer version of Pandoc
|
||
|
@markdownizable_extensions += %w[.rtf] if (@pandoc_version <=> [2, 14, 2]) >= 0
|
||
|
@markdownizable_extensions += %w[.xlsx .pptx] if (@pandoc_version <=> [3, 8, 3]) >= 0
|
||
|
@markdownizable_extensions
|
||
| test/fixtures/files/richtext.rtf | ||
|---|---|---|
|
{\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 \fmodern Courier;}}
|
||
|
{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}
|
||
|
\widowctrl\hyphauto
|
||
|
{\pard \qc \f0 \sa180 \li0 \fi0 \b \fs36 Redmine\par}
|
||
|
{\pard \ql \f0 \sa180 \li0 \fi0 \par}
|
||
|
{\pard \ql \f0 \sa180 \li0 \fi0 Redmine is a flexible project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database.\par}
|
||
|
{\pard \ql \f0 \sa180 \li0 \fi0 Redmine is open source and released under the terms of the GNU General Public License v2 (GPL).\par}
|
||
|
{\pard \ql \f0 \sa180 \li0 \fi0 \outlinelevel0 \b \fs36 Features\par}
|
||
|
{\pard \ql \f0 \sa180 \li0 \fi0 Some of the main features of Redmine are:\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multiple projects support\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Flexible role based access control\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Flexible issue tracking system\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Gantt chart and calendar\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab News, documents & files management\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Feeds & email notifications\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Per project wiki\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Per project forums\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Time tracking\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Custom fields for issues, time-entries, projects and users\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab SCM integration (SVN, CVS, Git, Mercurial and Bazaar)\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Issue creation via email\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multiple LDAP authentication support\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab User self-registration support\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multilanguage support\par}
|
||
|
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multiple databases support\sa180\par}
|
||
|
}
|
||
| test/functional/attachments_controller_test.rb | ||
|---|---|---|
|
assert_select '.nodata', :count => 0
|
||
|
end
|
||
|
def test_show_rtf
|
||
|
skip unless Redmine::Markdownizer.available?
|
||
|
set_tmp_attachments_directory
|
||
|
a = Attachment.new(
|
||
|
:container => Issue.find(1),
|
||
|
:file => uploaded_test_file('richtext.rtf', 'application/rtf'),
|
||
|
:author => User.find(1)
|
||
|
)
|
||
|
assert a.save
|
||
|
get(:show, :params => {:id => a.id})
|
||
|
assert_response :success
|
||
|
assert_equal 'text/html', @response.media_type
|
||
|
assert_select 'div.filecontent.wiki', :text => /Redmine is a flexible project management web application/
|
||
|
assert_select '.nodata', :count => 0
|
||
|
end
|
||
|
def test_show_other_with_no_preview
|
||
|
@request.session[:user_id] = 2
|
||
|
get(:show, :params => {:id => 6})
|
||