class HTMLLayout

Attributes

body[R]
title[R]
toc[R]

Public Class Methods

new(params, template) click to toggle source
# File ../../../../../lib/review/htmllayout.rb, line 7
def initialize(params, template)
  @body = params['body']
  @title = params['title']
  @toc = params['toc']
  @next = params['next']
  @prev = params['prev']
  @builder = params['builder']
  @language = params['language']
  @stylesheets = params['stylesheets']
  @template = template
end

Public Instance Methods

next_chapter() click to toggle source
# File ../../../../../lib/review/htmllayout.rb, line 20
def next_chapter
  if @next.present?
    "<a href='#{h @next.id}.html'>#{h @builder.compile_inline @next.title}</a>"
  else
    ""
  end
end
prev_chapter() click to toggle source
# File ../../../../../lib/review/htmllayout.rb, line 28
def prev_chapter
  if @prev.present?
    "<a href='#{h @prev.id}.html'>#{h @builder.compile_inline @prev.title}</a>"
  else
    ""
  end
end
result() click to toggle source
# File ../../../../../lib/review/htmllayout.rb, line 36
def result
  if File.exist?(@template)
    return ERB.new(IO.read(@template)).result(binding)
  else
    return @src
  end
end