Class: Rabbit::SourceGenerator::Markdown

Inherits:
Object
  • Object
show all
Includes:
GetText, PathManipulatable
Defined in:
lib/rabbit/source-generator/markdown.rb

Constant Summary

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GetText

included

Constructor Details

#initialize(logger = nil) ⇒ Markdown

Returns a new instance of Markdown.



26
27
28
# File 'lib/rabbit/source-generator/markdown.rb', line 26

def initialize(logger=nil)
  @logger = logger || Logger.default
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



25
26
27
# File 'lib/rabbit/source-generator/markdown.rb', line 25

def logger
  @logger
end

Instance Method Details

#comment(content) ⇒ Object



56
57
58
# File 'lib/rabbit/source-generator/markdown.rb', line 56

def comment(content)
  ""
end

#definition_list_item(item, description) ⇒ Object



34
35
36
37
38
39
# File 'lib/rabbit/source-generator/markdown.rb', line 34

def definition_list_item(item, description)
  [
    item,
    ":   #{description}",
  ].join("\n")
end

#heading(level, title) ⇒ Object



30
31
32
# File 'lib/rabbit/source-generator/markdown.rb', line 30

def heading(level, title)
  ("#" * level) + " #{title}"
end

#image(source, options = {}) ⇒ Object



45
46
47
48
49
50
# File 'lib/rabbit/source-generator/markdown.rb', line 45

def image(source, options={})
  parameters = options.collect do |key, value|
    "#{key}='#{value}'"
  end
  "![](#{source}){:#{parameters.join(' ')}}"
end

#preformatted_line(content) ⇒ Object



52
53
54
# File 'lib/rabbit/source-generator/markdown.rb', line 52

def preformatted_line(content)
  "    #{content}"
end

#unordered_list_item(item) ⇒ Object



41
42
43
# File 'lib/rabbit/source-generator/markdown.rb', line 41

def unordered_list_item(item)
  "* #{item}"
end