Module: Redmine::WikiFormatting::Macros

Defined in:
lib/redmine/wiki_formatting/macros.rb

Defined Under Namespace

Modules: Definitions

Constant Summary

@@available_macros =
{}

Class Method Summary

Class Method Details

+ (Object) register(&block)

Called with a block to define additional macros. Macro blocks accept 2 arguments:

  • obj: the object that is rendered
  • args: macro arguments

Plugins can use this method to define new macros:

  Redmine::WikiFormatting::Macros.register do
    desc "This is my macro"
    macro :my_macro do |obj, args|
      "My macro output"
    end
  end


53
54
55
# File 'lib/redmine/wiki_formatting/macros.rb', line 53

def register(&block)
  class_eval(&block) if block_given?
end