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



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

def block_code(code, language)
  "```#{language}#{$nl}#{code}#{$nl}```"
end

#code_span(text) ⇒ Object



65
66
67
# File 'lib/vimdeck.rb', line 65

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

#double_emphasis(text) ⇒ Object



73
74
75
# File 'lib/vimdeck.rb', line 73

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

#emphasis(text) ⇒ Object



69
70
71
# File 'lib/vimdeck.rb', line 69

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

#header(title, level) ⇒ Object



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

def header(title, level)
  margin = Vimdeck::Slideshow.options[:header_margin]
  linebreak = margin ? "#{$nl}" * margin : "#{$nl}"
  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( /\r\n?|\n/, "#{$nl}    " ) + linebreak
      else
        heading + linebreak
      end
    when 2
      heading = Vimdeck::Ascii.header(title, "small")
      if Vimdeck::Slideshow.options[:no_indent]
        heading = "    " + heading.gsub( /\r\n?|\n/, "#{$nl}    " ) + linebreak
      else
        heading + linebreak
      end
    end
  else
    title + "#{$nl}#{$nl}"
  end
end

#image(image, title, alt_text) ⇒ Object



126
127
128
# File 'lib/vimdeck.rb', line 126

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


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

def link(link, title, content)
  content
end

#list(content, type) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/vimdeck.rb', line 81

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

#paragraph(text) ⇒ Object



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

def paragraph(text)
  text + "#{$nl}#{$nl}"
end

#triple_emphasis(text) ⇒ Object



77
78
79
# File 'lib/vimdeck.rb', line 77

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