Class: Sendmark::Render
- Inherits:
-
Redcarpet::Render::HTML
- Object
- Redcarpet::Render::HTML
- Sendmark::Render
- Defined in:
- lib/sendmark/render.rb
Instance Method Summary collapse
- #header(text, header_level) ⇒ Object
-
#initialize(extentions) ⇒ Render
constructor
A new instance of Render.
- #link(link, title, content) ⇒ Object
- #list_item(text, list_type) ⇒ Object
- #paragraph(text) ⇒ Object
Constructor Details
#initialize(extentions) ⇒ Render
Returns a new instance of Render.
3 4 5 6 |
# File 'lib/sendmark/render.rb', line 3 def initialize(extentions) @css_parser = extentions[:css_parser] unless extentions[:css_parser].nil? super end |
Instance Method Details
#header(text, header_level) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/sendmark/render.rb', line 8 def header(text, header_level) tag = "h#{header_level}" if css_defined_with?(tag) "<#{tag} style=\"#{css_style(tag)}\">#{text}</#{tag}>" else "<#{tag}>#{text}</#{tag}>" end end |
#link(link, title, content) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/sendmark/render.rb', line 33 def link(link, title, content) if css_defined_with?("a") "<a style=\"#{css_style("a")}\" href=\"#{link}\">#{content}</a>" else "<a href=\"#{link}\">#{content}</a>" end end |
#list_item(text, list_type) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/sendmark/render.rb', line 17 def list_item(text, list_type) if css_defined_with?("li") "<li style=\"#{css_style("li")}\">#{text}</li>" else "<li>#{text}</li>" end end |
#paragraph(text) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/sendmark/render.rb', line 25 def paragraph(text) if css_defined_with?("p") "<p style=\"#{css_style("p")}\">#{text}</p>" else "<p>#{text}</p>" end end |