Module: Redmine::WikiFormatting

Defined in:
lib/redmine/wiki_formatting.rb,
lib/redmine/wiki_formatting/macros.rb,
lib/redmine/wiki_formatting/textile/helper.rb,
lib/redmine/wiki_formatting/textile/formatter.rb

Defined Under Namespace

Modules: Macros, NullFormatter, Textile

Constant Summary

@@formatters =
{}

Class Method Summary (collapse)

Class Method Details

+ (Object) format_names



42
43
44
# File 'lib/redmine/wiki_formatting.rb', line 42

def format_names
  @@formatters.keys.map
end

+ (Object) formatter_for(name)



32
33
34
35
# File 'lib/redmine/wiki_formatting.rb', line 32

def formatter_for(name)
  entry = @@formatters[name.to_sym]
  (entry && entry[:formatter]) || Redmine::WikiFormatting::NullFormatter::Formatter
end

+ (Object) helper_for(name)



37
38
39
40
# File 'lib/redmine/wiki_formatting.rb', line 37

def helper_for(name)
  entry = @@formatters[name.to_sym]
  (entry && entry[:helper]) || Redmine::WikiFormatting::NullFormatter::Helper
end

+ (Object) map {|_self| ... }

Yields:

  • (_self)

Yield Parameters:



23
24
25
# File 'lib/redmine/wiki_formatting.rb', line 23

def map
  yield self
end

+ (Object) register(name, formatter, helper)

Raises:

  • (ArgumentError)


27
28
29
30
# File 'lib/redmine/wiki_formatting.rb', line 27

def register(name, formatter, helper)
  raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_sym]
  @@formatters[name.to_sym] = {:formatter => formatter, :helper => helper}
end

+ (Object) to_html(format, text, options = {}, &block)



46
47
48
# File 'lib/redmine/wiki_formatting.rb', line 46

def to_html(format, text, options = {}, &block)
  formatter_for(format).new(text).to_html(&block)
end