Class: Caracal::Renderers::ContentTypesRenderer

Inherits:
XmlRenderer
  • Object
show all
Defined in:
lib/caracal/renderers/content_types_renderer.rb

Instance Attribute Summary

Attributes inherited from XmlRenderer

#document

Instance Method Summary collapse

Methods inherited from XmlRenderer

#initialize, render

Constructor Details

This class inherits a constructor from Caracal::Renderers::XmlRenderer

Instance Method Details

#to_xmlObject

This method produces the xml required for the ‘_.xml` sub-document.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/caracal/renderers/content_types_renderer.rb', line 17

def to_xml
  builder = ::Nokogiri::XML::Builder.with(declaration_xml) do |xml|
    xml.send 'Types', root_options do
      xml.send 'Default', { 'Extension' => 'gif',  'ContentType' => 'image/gif' }
      xml.send 'Default', { 'Extension' => 'jpeg', 'ContentType' => 'image/jpeg' }
      xml.send 'Default', { 'Extension' => 'jpg',  'ContentType' => 'image/jpeg' }
      xml.send 'Default', { 'Extension' => 'png',  'ContentType' => 'image/png' }
      xml.send 'Default', { 'Extension' => 'rels', 'ContentType' => 'application/vnd.openxmlformats-package.relationships+xml' }
      xml.send 'Default', { 'Extension' => 'xml',  'ContentType' => 'application/xml' }
      xml.send 'Override', { 'PartName' => '/docProps/app.xml',   'ContentType' => 'application/vnd.openxmlformats-officedocument.extended-properties+xml' }
      xml.send 'Override', { 'PartName' => '/docProps/core.xml',  'ContentType' => 'application/vnd.openxmlformats-package.core-properties+xml' }
      xml.send 'Override', { 'PartName' => '/word/document.xml',  'ContentType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml' }
      xml.send 'Override', { 'PartName' => '/word/footer1.xml',   'ContentType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml' }
      xml.send 'Override', { 'PartName' => '/word/fontTable.xml', 'ContentType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml' }
      xml.send 'Override', { 'PartName' => '/word/numbering.xml', 'ContentType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml' }
      xml.send 'Override', { 'PartName' => '/word/settings.xml',  'ContentType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml' }
      xml.send 'Override', { 'PartName' => '/word/styles.xml',    'ContentType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml' }
    end
  end
  builder.to_xml(save_options)
end