-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.rb
51 lines (47 loc) · 1.66 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require File.expand_path('lib/callout_macro_hook', __dir__)
Redmine::Plugin.register :redmine_callout_macro do
name 'Redmine Callout Macro plugin'
author 'taikii'
description 'Add Callouts to wiki.'
version '1.0.2'
url 'https://github.com/taikii/redmine_callout_macro'
author_url 'https://taikii.net/'
Redmine::WikiFormatting::Macros.register do
desc "Add Callouts to wiki. Example:\n\n" +
"{{info(INFO)\n" +
"This is information block.\n" +
"}}"
macro :info do |obj, args, text|
out = ''.html_safe
out << content_tag(:div, :class => 'callout-info callout') do
concat content_tag(:p, args.first.to_s, :class => 'callout-header') if args.size > 0
concat textilizable(text, :object => obj, :headings => false)
end
out
end
desc "Add Callouts to wiki. Example:\n\n" +
"{{warning(WARNING)\n" +
"This is warning block.\n" +
"}}"
macro :warning do |obj, args, text|
out = ''.html_safe
out << content_tag(:div, :class => 'callout-warning callout') do
concat content_tag(:p, args.first.to_s, :class => 'callout-header') if args.size > 0
concat textilizable(text, :object => obj, :headings => false)
end
out
end
desc "Add Callouts to wiki. Example:\n\n" +
"{{danger(INFO)\n" +
"This is danger block.\n" +
"}}"
macro :danger do |obj, args, text|
out = ''.html_safe
out << content_tag(:div, :class => 'callout-danger callout') do
concat content_tag(:p, args.first.to_s, :class => 'callout-header') if args.size > 0
concat textilizable(text, :object => obj, :headings => false)
end
out
end
end
end