Sha256: d992b9bb8ded15b89d030b6e06cc32dd887a1d6021667c3de31da5848c5857bb

Contents?: true

Size: 1.29 KB

Versions: 26

Compression:

Stored size: 1.29 KB

Contents

require 'nokogiri'

require 'caracal/renderers/xml_renderer'


module Caracal
  module Renderers
    class CoreRenderer < XmlRenderer
      
      #-------------------------------------------------------------
      # Public Methods
      #-------------------------------------------------------------
      
      # This method produces the xml required for the `docProps/core.xml` 
      # sub-document.
      #
      def to_xml
        builder = ::Nokogiri::XML::Builder.with(declaration_xml) do |xml|
          xml.send 'cp:coreProperties', root_options do
            xml['dc'].title document.name
          end
        end
        builder.to_xml(save_options)
      end
      
      
      #-------------------------------------------------------------
      # Private Methods
      #------------------------------------------------------------- 
      private
      
      def root_options
        {
          'xmlns:cp'        => 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',
          'xmlns:dc'        => 'http://purl.org/dc/elements/1.1/',
          'xmlns:dcterms'   => 'http://purl.org/dc/terms/',
          'xmlns:dcmitype'  => 'http://purl.org/dc/dcmitype/',
          'xmlns:xsi'       => 'http://www.w3.org/2001/XMLSchema-instance'
        }
      end
   
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
caracal-1.0.13 lib/caracal/renderers/core_renderer.rb
caracal-1.0.12 lib/caracal/renderers/core_renderer.rb
caracal-1.0.11 lib/caracal/renderers/core_renderer.rb
caracal-1.0.10 lib/caracal/renderers/core_renderer.rb
caracal-1.0.9 lib/caracal/renderers/core_renderer.rb
caracal-1.0.8 lib/caracal/renderers/core_renderer.rb
caracal-1.0.7 lib/caracal/renderers/core_renderer.rb
caracal-1.0.6 lib/caracal/renderers/core_renderer.rb
caracal-1.0.5 lib/caracal/renderers/core_renderer.rb
caracal-1.0.4 lib/caracal/renderers/core_renderer.rb
caracal-1.0.3 lib/caracal/renderers/core_renderer.rb
caracal-1.0.2 lib/caracal/renderers/core_renderer.rb
caracal-1.0.1 lib/caracal/renderers/core_renderer.rb
caracal-1.0.0 lib/caracal/renderers/core_renderer.rb
caracal-0.3.0 lib/caracal/renderers/core_renderer.rb
caracal-0.2.1 lib/caracal/renderers/core_renderer.rb
caracal-0.2.0 lib/caracal/renderers/core_renderer.rb
caracal-0.1.8 lib/caracal/renderers/core_renderer.rb
caracal-0.1.7 lib/caracal/renderers/core_renderer.rb
caracal-0.1.6 lib/caracal/renderers/core_renderer.rb