redmine_wiki_notes/lib/wiki_notes_macros.rb

46 lines
1.5 KiB
Ruby
Raw Normal View History

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" +
"<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)
end
content_tag('div', o.html_safe, :class => "noteclassic")
2010-08-02 20:25:34 +02:00
end
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)
end
content_tag('div', o.html_safe, :class => "notetip")
2010-08-02 20:25:34 +02:00
end
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)
end
content_tag('div', o.html_safe, :class => "noteimportant")
2010-08-02 20:25:34 +02:00
end
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)
end
content_tag('div', o.html_safe, :class => "notewarning")
2010-08-02 20:25:34 +02:00
end
end
2010-08-02 20:25:34 +02:00
end