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,
lib/redmine/wiki_formatting/null_formatter/helper.rb,
lib/redmine/wiki_formatting/null_formatter/formatter.rb

Defined Under Namespace

Modules: Macros, NullFormatter, Textile

Constant Summary

@@formatters =
{}

Class Method Summary (collapse)

Class Method Details

+ (Object) format_names



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

def format_names
  @@formatters.keys.map
end

+ (Object) formatter_for(name)



29
30
31
32
# File 'lib/redmine/wiki_formatting.rb', line 29

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

+ (Object) helper_for(name)



34
35
36
37
# File 'lib/redmine/wiki_formatting.rb', line 34

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

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

Yields:

  • (_self)

Yield Parameters:



20
21
22
# File 'lib/redmine/wiki_formatting.rb', line 20

def map
  yield self
end

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

Raises:

  • (ArgumentError)


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

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

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



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

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