Class: Vimdeck::Render
- Inherits:
-
Redcarpet::Render::Base
- Object
- Redcarpet::Render::Base
- Vimdeck::Render
- Defined in:
- lib/vimdeck.rb
Overview
Custom Redcarpet renderer handles headers and images Code blocks are ignored by the renderer because they have to be measured for the vimscript, so parsing of the fenced code blocks happens in the slideshow generator itself
Instance Method Summary collapse
- #block_code(code, language) ⇒ Object
- #code_span(text) ⇒ Object
- #double_emphasis(text) ⇒ Object
- #emphasis(text) ⇒ Object
- #header(title, level) ⇒ Object
- #image(image, title, alt_text) ⇒ Object
- #link(link, title, content) ⇒ Object
- #list(content, type) ⇒ Object
- #paragraph(text) ⇒ Object
- #triple_emphasis(text) ⇒ Object
Instance Method Details
#block_code(code, language) ⇒ Object
110 111 112 |
# File 'lib/vimdeck.rb', line 110 def block_code(code, language) "```#{language}\n#{code}\n```" end |
#code_span(text) ⇒ Object
55 56 57 |
# File 'lib/vimdeck.rb', line 55 def code_span(text) return "`#{text}`" end |
#double_emphasis(text) ⇒ Object
63 64 65 |
# File 'lib/vimdeck.rb', line 63 def double_emphasis(text) return "**#{text}**" end |
#emphasis(text) ⇒ Object
59 60 61 |
# File 'lib/vimdeck.rb', line 59 def emphasis(text) return "*#{text}*" end |
#header(title, level) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/vimdeck.rb', line 79 def header(title, level) if !Vimdeck::Slideshow.[:no_ascii] case level when 1 heading = Vimdeck::Ascii.header(title, "large") if Vimdeck::Slideshow.[:no_indent] heading = " " + heading.gsub( /\n/, "\n " ) + "\n" else heading + "\n" end when 2 heading = Vimdeck::Ascii.header(title, "small") if Vimdeck::Slideshow.[:no_indent] heading = " " + heading.gsub( /\n/, "\n " ) + "\n" else heading + "\n" end end else title + "\n\n" end end |
#image(image, title, alt_text) ⇒ Object
114 115 116 |
# File 'lib/vimdeck.rb', line 114 def image(image, title, alt_text) Vimdeck::Ascii.image(image) end |
#link(link, title, content) ⇒ Object
102 103 104 |
# File 'lib/vimdeck.rb', line 102 def link(link, title, content) content end |
#list(content, type) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/vimdeck.rb', line 71 def list(content, type) if type == :unordered "<!~#{content}~!>" else "<@~#{content}~@>" end end |
#paragraph(text) ⇒ Object
106 107 108 |
# File 'lib/vimdeck.rb', line 106 def paragraph(text) text + "\n\n" end |
#triple_emphasis(text) ⇒ Object
67 68 69 |
# File 'lib/vimdeck.rb', line 67 def triple_emphasis(text) return "***#{text}***" end |