PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/init.rb

https://bitbucket.org/ichizok/redmine_pygments
Ruby | 29 lines | 24 code | 5 blank | 0 comment | 4 complexity | b81fff6fc86327d7f5a3a77ea1c2c0dc MD5 | raw file
  1. require 'redmine'
  2. require 'redmine/syntax_highlighting/pygments'
  3. Rails.configuration.to_prepare do
  4. require_dependency 'application_helper'
  5. ApplicationHelper.send(:include, PygmentsApplicationHelperPatch)
  6. require_dependency 'redmine/wiki_formatting/textile/formatter'
  7. Redmine::WikiFormatting::Textile::Formatter.send(:include, PygmentsTextileFormatterPatch)
  8. if Redmine::VERSION::MAJOR > 2 || (Redmine::VERSION::MAJOR == 2 && Redmine::VERSION::MINOR >= 5)
  9. require_dependency 'redmine/wiki_formatting/markdown/formatter'
  10. Redmine::WikiFormatting::Markdown::HTML.send(:include, PygmentsMarkdownFormatterPatch)
  11. end
  12. end
  13. Redmine::Plugin.register :redmine_pygments do
  14. name 'Redmine Pygments plugin'
  15. author 'ichizok'
  16. description 'Syntax-highlighter powered by Pygments'
  17. version '0.3.0.1'
  18. url 'https://bitbucket.org/ichizok/redmine_pygments'
  19. author_url 'https://bitbucket.org/ichizok'
  20. requires_redmine :version_or_higher => '2.0.0'
  21. end
  22. class PygmentsStylesheetHook < Redmine::Hook::ViewListener
  23. render_on :view_layouts_base_html_head, :inline => "<%= stylesheet_link_tag 'highlight', :plugin => 'redmine_pygments' %>"
  24. end