Class: Vimdeck::Render

Inherits:
Redcarpet::Render::Base
  • Object
show all
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

Instance Method Details

#block_code(code, language) ⇒ Object



118
119
120
# File 'lib/vimdeck.rb', line 118

def block_code(code, language)
  "```#{language}\n#{code}\n```"
end

#code_span(text) ⇒ Object



63
64
65
# File 'lib/vimdeck.rb', line 63

def code_span(text)
  return "`#{text}`"
end

#double_emphasis(text) ⇒ Object



71
72
73
# File 'lib/vimdeck.rb', line 71

def double_emphasis(text)
  return "**#{text}**"
end

#emphasis(text) ⇒ Object



67
68
69
# File 'lib/vimdeck.rb', line 67

def emphasis(text)
  return "*#{text}*"
end

#header(title, level) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/vimdeck.rb', line 87

def header(title, level)
  if !Vimdeck::Slideshow.options[:no_ascii]
    case level
    when 1
      heading = Vimdeck::Ascii.header(title, "large")
      if Vimdeck::Slideshow.options[:no_indent]
        heading = "    " + heading.gsub( /\n/, "\n    " ) + "\n"
      else
        heading + "\n"
      end
    when 2
      heading = Vimdeck::Ascii.header(title, "small")
      if Vimdeck::Slideshow.options[: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



122
123
124
# File 'lib/vimdeck.rb', line 122

def image(image, title, alt_text)
  Vimdeck::Ascii.image(image)
end


110
111
112
# File 'lib/vimdeck.rb', line 110

def link(link, title, content)
  content
end

#list(content, type) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/vimdeck.rb', line 79

def list(content, type)
  if type == :unordered
    "<!~#{content}~!>\n\n"
  else
    "<@~#{content}~@>\n\n"
  end
end

#paragraph(text) ⇒ Object



114
115
116
# File 'lib/vimdeck.rb', line 114

def paragraph(text)
  text + "\n\n"
end

#triple_emphasis(text) ⇒ Object



75
76
77
# File 'lib/vimdeck.rb', line 75

def triple_emphasis(text)
  return "***#{text}***"
end