Feature #44435 ยป 0001-Add-preview-support-for-Rich-Text-Format-.rtf-files.patch
| config/configuration.yml.example | ||
|---|---|---|
| 240 | 240 |
# - example.org |
| 241 | 241 |
# - "*.example.com" |
| 242 |
# Preview for Office documents (Microsoft Office / LibreOffice) |
|
| 242 |
# Preview for Office documents (Microsoft Office / LibreOffice / RTF)
|
|
| 243 | 243 |
# |
| 244 |
# Redmine uses Pandoc to convert supported Microsoft Office and LibreOffice
|
|
| 245 |
# attachments to Markdown for preview. The settings below named |
|
| 244 |
# Redmine uses Pandoc to convert supported Microsoft Office, LibreOffice and
|
|
| 245 |
# Rich Text Format attachments to Markdown for preview. The settings below named
|
|
| 246 | 246 |
# `markdownized_preview_*` control that Markdown-based preview generation. |
| 247 | 247 |
# |
| 248 | 248 |
# Absolute path (e.g. /usr/local/bin/pandoc) to the Pandoc command |
| doc/INSTALL | ||
|---|---|---|
| 20 | 20 |
available in PATH) |
| 21 | 21 |
* ImageMagick (to enable thumbnail generation and Gantt export to PNG images) |
| 22 | 22 |
* Ghostscript (to enable thumbnail generation for PDF attachments) |
| 23 |
* Pandoc, to enable previews for Microsoft Office (.docx, .xlsx, .pptx) and |
|
| 24 |
LibreOffice Writer (.odt) documents. Version 3.8.3 or later is recommended. |
|
| 25 |
Older versions of Pandoc supports only .docx and .odt documents. |
|
| 23 |
* Pandoc, to enable previews for Microsoft Office (.docx, .xlsx, .pptx), |
|
| 24 |
LibreOffice Writer (.odt) and Rich Text Format (.rtf) documents. |
|
| 25 |
Version 3.8.3 or later is recommended. Older versions of Pandoc supports |
|
| 26 |
only .docx and .odt documents (.rtf requires 2.14.2 or later). |
|
| 26 | 27 |
Supported browsers: |
| 27 | 28 |
The current version of Firefox, Safari, Chrome, Chromium and Microsoft Edge. |
| lib/redmine/markdownizer.rb | ||
|---|---|---|
| 103 | 103 |
else |
| 104 | 104 |
return (@markdownizable_extensions = []) |
| 105 | 105 |
end |
| 106 |
# Pandoc >= 3.8.3 supports Microsoft Excel and PowerPoint files |
|
| 106 |
# Formats that require a newer version of Pandoc |
|
| 107 |
@markdownizable_extensions += %w[.rtf] if (@pandoc_version <=> [2, 14, 2]) >= 0 |
|
| 107 | 108 |
@markdownizable_extensions += %w[.xlsx .pptx] if (@pandoc_version <=> [3, 8, 3]) >= 0 |
| 108 | 109 |
@markdownizable_extensions |
| test/fixtures/files/richtext.rtf | ||
|---|---|---|
| 1 |
{\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 \fmodern Courier;}}
|
|
| 2 |
{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}
|
|
| 3 |
\widowctrl\hyphauto |
|
| 4 | ||
| 5 |
{\pard \qc \f0 \sa180 \li0 \fi0 \b \fs36 Redmine\par}
|
|
| 6 |
{\pard \ql \f0 \sa180 \li0 \fi0 \par}
|
|
| 7 |
{\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}
|
|
| 8 |
{\pard \ql \f0 \sa180 \li0 \fi0 Redmine is open source and released under the terms of the GNU General Public License v2 (GPL).\par}
|
|
| 9 |
{\pard \ql \f0 \sa180 \li0 \fi0 \outlinelevel0 \b \fs36 Features\par}
|
|
| 10 |
{\pard \ql \f0 \sa180 \li0 \fi0 Some of the main features of Redmine are:\par}
|
|
| 11 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multiple projects support\par}
|
|
| 12 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Flexible role based access control\par}
|
|
| 13 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Flexible issue tracking system\par}
|
|
| 14 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Gantt chart and calendar\par}
|
|
| 15 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab News, documents & files management\par}
|
|
| 16 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Feeds & email notifications\par}
|
|
| 17 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Per project wiki\par}
|
|
| 18 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Per project forums\par}
|
|
| 19 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Time tracking\par}
|
|
| 20 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Custom fields for issues, time-entries, projects and users\par}
|
|
| 21 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab SCM integration (SVN, CVS, Git, Mercurial and Bazaar)\par}
|
|
| 22 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Issue creation via email\par}
|
|
| 23 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multiple LDAP authentication support\par}
|
|
| 24 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab User self-registration support\par}
|
|
| 25 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multilanguage support\par}
|
|
| 26 |
{\pard \ql \f0 \sa180 \li360 \fi-360 \bullet \tx360\tab Multiple databases support\sa180\par}
|
|
| 27 |
} |
|
| test/functional/attachments_controller_test.rb | ||
|---|---|---|
| 311 | 311 |
assert_select '.nodata', :count => 0 |
| 312 | 312 |
end |
| 313 |
def test_show_rtf |
|
| 314 |
skip unless Redmine::Markdownizer.available? |
|
| 315 | ||
| 316 |
set_tmp_attachments_directory |
|
| 317 |
a = Attachment.new( |
|
| 318 |
:container => Issue.find(1), |
|
| 319 |
:file => uploaded_test_file('richtext.rtf', 'application/rtf'),
|
|
| 320 |
:author => User.find(1) |
|
| 321 |
) |
|
| 322 |
assert a.save |
|
| 323 | ||
| 324 |
get(:show, :params => {:id => a.id})
|
|
| 325 | ||
| 326 |
assert_response :success |
|
| 327 |
assert_equal 'text/html', @response.media_type |
|
| 328 |
assert_select 'div.filecontent.wiki', :text => /Redmine is a flexible project management web application/ |
|
| 329 |
assert_select '.nodata', :count => 0 |
|
| 330 |
end |
|
| 331 | ||
| 313 | 332 |
def test_show_other_with_no_preview |
| 314 | 333 |
@request.session[:user_id] = 2 |
| 315 | 334 |
get(:show, :params => {:id => 6})
|