class BookChef::Compiler::HTML

Converts XML into HTML using xslt

Attributes

document[R]
result[R]

Public Class Methods

new(fn, xslt_stylesheet=" click to toggle source
# File lib/bookchef/compilers/html.rb, line 9
def initialize(fn, xslt_stylesheet="#{BookChef::LIB_PATH}/stylesheets/xslt/bookchef_to_html.xsl")
  xslt_stylesheet = File.read(xslt_stylesheet).sub('#{gem_path}', "file://#{BookChef::LIB_PATH}")
  @document     = XML::XSLT.new
  @document.xml = fn
  @document.xsl = xslt_stylesheet
end

Public Instance Methods

run() click to toggle source
# File lib/bookchef/compilers/html.rb, line 16
def run
  @result = BookChef.decode_special_chars(@document.serve)
  @result = BookChef.replace_https_with_http(@result)
end
save_to(fn) click to toggle source
# File lib/bookchef/compilers/html.rb, line 21
def save_to(fn)
  f = File.open(fn, "w")
  f.write @result 
  f.close
end