Class: Bookingit::HtmlRenderer

Inherits:
Renderer
  • Object
show all
Includes:
FileUtils
Defined in:
lib/bookingit/html_renderer.rb

Constant Summary

Constants inherited from Renderer

Renderer::EXTENSION_TO_LANGUAGE

Instance Attribute Summary

Attributes inherited from Renderer

#headers, #images, #stylesheets, #theme

Instance Method Summary collapse

Methods inherited from Renderer

#block_code, #current_chapter=, #doc_footer, #doc_header, #header, #identify_language, #image, #initialize, #record_sections=

Constructor Details

This class inherits a constructor from Bookingit::Renderer

Instance Method Details

#css_class(language) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/bookingit/html_renderer.rb', line 29

def css_class(language)
  if language.nil? || language.strip == ''
    ""
  else
    " class=\"language-#{language}\""
  end
end

#render_block_code(code, filename, language) ⇒ Object



25
26
27
# File 'lib/bookingit/html_renderer.rb', line 25

def render_block_code(code,filename,language)
  Views::CodeView.new(code,filename,language,@config).render.strip
end


21
22
23
# File 'lib/bookingit/html_renderer.rb', line 21

def render_doc_footer
  Views::FooterView.new(@chapter,@config).render
end

#render_doc_headerObject



17
18
19
# File 'lib/bookingit/html_renderer.rb', line 17

def render_doc_header
  Views::HeaderView.new(@stylesheets,@theme,@config).render
end

#render_header(text, header_level, anchor) ⇒ Object



9
10
11
# File 'lib/bookingit/html_renderer.rb', line 9

def render_header(text,header_level,anchor)
  "<a name='#{anchor}'></a><h#{header_level+1}>#{text}</h#{header_level+1}>"
end

#render_image(link, title, alt_text) ⇒ Object



13
14
15
# File 'lib/bookingit/html_renderer.rb', line 13

def render_image(link, title, alt_text)
  "<img src='#{link}' alt='#{alt_text}' title='#{title}'>"
end