diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-06-09 18:40:59 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-06-09 18:40:59 +0000 |
commit | 80a7486f95a39ad3fc0946fad17fe51cff01cec6 (patch) | |
tree | 43e4ce8c5d338458359b5a8cf389972c93ac56f3 /app/helpers/application_helper.rb | |
parent | aa0beecad0fa7cd8c62816b4dc7918f03b214b91 (diff) | |
download | redmine-80a7486f95a39ad3fc0946fad17fe51cff01cec6.tar.gz redmine-80a7486f95a39ad3fc0946fad17fe51cff01cec6.zip |
File viewer for attached text files.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1520 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 405c5bf44..16904c251 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -15,6 +15,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +require 'coderay' +require 'coderay/helpers/file_type' + module ApplicationHelper include Redmine::WikiFormatting::Macros::Definitions @@ -116,6 +119,11 @@ module ApplicationHelper l(:actionview_datehelper_select_month_names).split(',')[month-1] end + def syntax_highlight(name, content) + type = CodeRay::FileType[name] + type ? CodeRay.scan(content, type).html : h(content) + end + def pagination_links_full(paginator, count=nil, options={}) page_param = options.delete(:page_param) || :page url_param = params.dup |