-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.rb
33 lines (29 loc) · 1.28 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Redmine::Plugin.register :redmine_codebutton do
name 'Code Highlight plugin'
author 'Jan Jezek'
description 'This is a plugin for Redmine. It adds a CodeHighlight Button to the editor, which wraps a code around selected text'
version '0.3.0'
url 'https://github.com/mediatainment/redmine-codebutton'
author_url 'http://www.mediatainment-productions.com'
settings :default => {
'default_language' => false,
'markdown_syntax' => '~~~'
}, :partial => 'redmine_codebutton_settings'
end
Rails.configuration.to_prepare do
# Guards against including the module multiple time (like in tests)
# and registering multiple callbacks
# send Patches to all wiki formatters available to be able to switch formatter without app restart
Redmine::WikiFormatting::format_names.each do |format|
case format
when "markdown"
unless Redmine::WikiFormatting::Markdown::Helper.included_modules.include? WikiCodehighlightHelperPatch
Redmine::WikiFormatting::Markdown::Helper.send(:include, WikiCodehighlightHelperPatch)
end
when "textile"
unless Redmine::WikiFormatting::Textile::Helper.included_modules.include? WikiCodehighlightHelperPatch
Redmine::WikiFormatting::Textile::Helper.send(:include, WikiCodehighlightHelperPatch)
end
end
end
end