Sha256: a407c45a5cd3cc7a6bfc8361e210cc47da841bdede678adbb62ce33e2513270f
Contents?: true
Size: 907 Bytes
Versions: 4
Compression:
Stored size: 907 Bytes
Contents
# -*- encoding: utf-8 -*- require 'fileutils' module Genit # Write an html or xml document. class DocumentWriter # Public: Constructor. # # working_dir - The String working directory, where live the project. def initialize working_dir @working_dir = working_dir end # Save the document as an xhtml file. # # document - A Nokogiri::HTML or Nokogiri::XML document # filename - The String name of the future saved document def save_as_xhtml document, filename @document = document remove_remaining_tags FileWriter.write document.to_xhtml, get_full_path(filename.force_html_extension) end private def remove_remaining_tags tags = @document.css 'genit' tags.each {|tag| tag.remove} end def get_full_path filename File.join(@working_dir, 'www', filename) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
genit-1.0 | lib/genit/documents/document_writer.rb |
genit-0.99 | lib/genit/documents/document_writer.rb |
genit-0.9 | lib/genit/documents/document_writer.rb |
genit-0.5 | lib/genit/document_writer.rb |