lib/bookingit/renderer.rb in bookingit-0.4.1 vs lib/bookingit/renderer.rb in bookingit-0.5.0
- old
+ new
@@ -40,26 +40,26 @@
@headers[header_level] ||= []
@headers[header_level] << text
if header_level == 2 && @record_sections
@chapter.add_section(text,anchor)
end
- "<a name='#{anchor}'></a><h#{header_level+1}>#{text}</h#{header_level+1}>"
+ render_header(text,header_level,anchor)
end
def image(link, title, alt_text)
title = title.gsub(/'/,'"') if title
@images << link
- "<img src='#{link}' alt='#{alt_text}' title='#{title}'>"
+ render_image(link, title, alt_text)
end
def doc_header
@headers = {}
- Views::HeaderView.new(@stylesheets,@theme,@config).render
+ render_doc_header
end
def doc_footer
- Views::FooterView.new(@chapter,@config).render
+ render_doc_footer
end
EXTENSION_TO_LANGUAGE = {
/\.rb$/ => 'ruby',
/\.html$/ => 'html',
@@ -86,11 +86,11 @@
.when_shell_command( &cache(:run_shell_command))
.otherwise {
[code,language,nil]
}.result
end
- Views::CodeView.new(code,filename,language,@config).render.strip
+ render_block_code(code,filename,language)
end
private
def cache(method_name)
@@ -183,24 +183,8 @@
end
def run_shell_command(shell_command)
shell_command.run!
["> #{shell_command.command}\n#{shell_command.stdout}",'shell']
- end
-
- def css_class(language)
- if language.nil? || language.strip == ''
- ""
- else
- " class=\"language-#{language}\""
- end
- end
-
- def filename_footer(filename)
- if filename && filename.strip != ''
- %{<footer><h1>#{filename}</h1></footer>}
- else
- ''
- end
end
end
end