Class: Caracal::Renderers::DocumentRenderer
- Inherits:
-
XmlRenderer
- Object
- XmlRenderer
- Caracal::Renderers::DocumentRenderer
- Defined in:
- lib/caracal/renderers/document_renderer.rb
Instance Attribute Summary
Attributes inherited from XmlRenderer
Instance Method Summary collapse
-
#to_xml ⇒ Object
This method produces the xml required for the ‘word/document.xml` sub-document.
Methods inherited from XmlRenderer
Constructor Details
This class inherits a constructor from Caracal::Renderers::XmlRenderer
Instance Method Details
#to_xml ⇒ Object
This method produces the xml required for the ‘word/document.xml` sub-document.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/caracal/renderers/document_renderer.rb', line 18 def to_xml builder = ::Nokogiri::XML::Builder.with(declaration_xml) do |xml| xml['w'].document do xml['w'].background({ 'w:color' => 'FFFFFF' }) xml['w'].body do #============= CONTENTS =================================== document.contents.each do |model| method = render_method_for_model(model) send(method, xml, model) end #============= PAGE SETTINGS ============================== xml['w'].sectPr do if document.page_number_show if rel = document.find_relationship('footer1.xml') xml['w'].({ 'r:id' => rel.formatted_id, 'w:type' => 'default' }) end end xml['w'].pgSz xml['w'].pgMar end end end end builder.to_xml() end |