2022-06-22 11:12:42 +02:00
|
|
|
module WikiNotesMacros
|
2010-08-02 20:25:34 +02:00
|
|
|
Redmine::WikiFormatting::Macros.register do
|
|
|
|
desc "Adds a note to the wiki page:\n\n" +
|
2015-01-17 00:00:47 +01:00
|
|
|
"<pre>\n" +
|
|
|
|
"{{note(text with *wiki formatting*)}}\n" +
|
|
|
|
"{{note\nAlternately, you can put blocks of *wiki-formatted* text here.\n}}\n" +
|
|
|
|
"{{note(Or if you really want)\nYou can do both...\n}}\n" +
|
|
|
|
"</pre>"
|
|
|
|
macro :note, :parse_args => false do |obj, args, text|
|
|
|
|
o = textilizable(args)
|
|
|
|
if text.present?
|
2021-04-08 18:18:30 +02:00
|
|
|
o += textilizable(text, :object => obj, :headings => false)
|
2015-01-17 00:00:47 +01:00
|
|
|
end
|
|
|
|
content_tag('div', o.html_safe, :class => "noteclassic")
|
2010-08-02 20:25:34 +02:00
|
|
|
end
|
|
|
|
|
2015-01-17 00:00:47 +01:00
|
|
|
desc "Variant of @note@."
|
|
|
|
macro :tip, :parse_args => false do |obj, args, text|
|
|
|
|
o = textilizable(args)
|
|
|
|
if text.present?
|
2021-04-08 18:18:30 +02:00
|
|
|
o += textilizable(text, :object => obj, :headings => false)
|
2015-01-17 00:00:47 +01:00
|
|
|
end
|
|
|
|
content_tag('div', o.html_safe, :class => "notetip")
|
2010-08-02 20:25:34 +02:00
|
|
|
end
|
|
|
|
|
2015-01-17 00:00:47 +01:00
|
|
|
desc "Variant of @note@."
|
|
|
|
macro :important, :parse_args => false do |obj, args, text|
|
|
|
|
o = textilizable(args)
|
|
|
|
if text.present?
|
2021-04-08 18:18:30 +02:00
|
|
|
o += textilizable(text, :object => obj, :headings => false)
|
2015-01-17 00:00:47 +01:00
|
|
|
end
|
|
|
|
content_tag('div', o.html_safe, :class => "noteimportant")
|
2010-08-02 20:25:34 +02:00
|
|
|
end
|
|
|
|
|
2015-01-17 00:00:47 +01:00
|
|
|
desc "Variant of @note@."
|
|
|
|
macro :warning, :parse_args => false do |obj, args, text|
|
|
|
|
o = textilizable(args)
|
|
|
|
if text.present?
|
2021-04-08 18:18:30 +02:00
|
|
|
o += textilizable(text, :object => obj, :headings => false)
|
2015-01-17 00:00:47 +01:00
|
|
|
end
|
|
|
|
content_tag('div', o.html_safe, :class => "notewarning")
|
2010-08-02 20:25:34 +02:00
|
|
|
end
|
|
|
|
end
|
2015-01-17 00:00:47 +01:00
|
|
|
|
2010-08-02 20:25:34 +02:00
|
|
|
end
|