Sha256: d945714c41f64b037e42d4049329cef825d4a2872c4998e8ae3ab0a18cc82a52

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

module Docxtor2
  class Package::Document < Package::Part
    def initialize(content, filepath = DOCUMENT_XML_PATH)
      super(filepath, self.class.render(content))
    end

    def self.render(content)
      xml = Builder::XmlMarkup.new
      
      xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8", :standalone => "yes"
      xml.w :document, "xmlns:ve" => "http://schemas.openxmlformats.org/markup-compatibility/2006",
                       "xmlns:o" => "urn:schemas-microsoft-com:office:office",
                       "xmlns:r" => "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
                       "xmlns:m" => "http://schemas.openxmlformats.org/officeDocument/2006/math",
                       "xmlns:v" => "urn:schemas-microsoft-com:vml",
                       "xmlns:wp" => "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
                       "xmlns:w10" => "urn:schemas-microsoft-com:office:word",
                       "xmlns:w" => "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
                       "xmlns:wne" => "http://schemas.microsoft.com/office/word/2006/wordml" do
        xml.w :body do
          xml << content
        end
      end

      xml.target!
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docxtor2-0.0.9 lib/docxtor2/package/document.rb
docxtor2-0.1.0 lib/docxtor2/package/document.rb