Class: PPTXMarkdown::Presentation
- Inherits:
-
Struct
- Object
- Struct
- PPTXMarkdown::Presentation
- Defined in:
- lib/pptx_markdown/presentation.rb
Instance Attribute Summary collapse
-
#slides ⇒ Object
Returns the value of attribute slides.
Instance Method Summary collapse
-
#initialize ⇒ Presentation
constructor
A new instance of Presentation.
- #to_markdown ⇒ Object
-
#to_xml ⇒ String
XML for ppt/presentation.xml.
-
#to_xml_rels ⇒ String
XML for ppt/_rels/presentation.xml.rels.
Constructor Details
#initialize ⇒ Presentation
Returns a new instance of Presentation.
3 4 5 6 |
# File 'lib/pptx_markdown/presentation.rb', line 3 def initialize(*) super self. ||= [] end |
Instance Attribute Details
#slides ⇒ Object
Returns the value of attribute slides
2 3 4 |
# File 'lib/pptx_markdown/presentation.rb', line 2 def @slides end |
Instance Method Details
#to_markdown ⇒ Object
8 9 10 |
# File 'lib/pptx_markdown/presentation.rb', line 8 def to_markdown .map(&:to_markdown).join end |
#to_xml ⇒ String
Returns XML for ppt/presentation.xml.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pptx_markdown/presentation.rb', line 13 def to_xml Nokogiri::XML::Builder.new do |xml| xml['p'].presentation(XML_NAMESPACES) do xml.sldMasterIdLst do xml.sldMasterId(id: 2_147_483_648, 'r:id' => 'rId1') end xml.sldIdLst do .each_with_index do |_, index| xml.sldId( id: 255 + (index + 1), 'r:id' => "rId#{(index + 1) + 5}" ) end end xml.sldSz(cx: 9_144_000, cy: 6_858_000, type: 'screen4x3') xml.notesSz(cx: 6_858_000, cy: 9_144_000) end end.to_xml end |
#to_xml_rels ⇒ String
Returns XML for ppt/_rels/presentation.xml.rels.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/pptx_markdown/presentation.rb', line 34 def to_xml_rels Nokogiri::XML::Builder.new do |xml| xml.Relationships(xmlns: 'http://schemas.openxmlformats.org/package/2006/relationships') do xml.Relationship( 'Id' => 'rId1', 'Type' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', 'Target' => 'theme/theme1.xml' ) xml.Relationship( 'Id' => 'rId2', 'Type' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps', 'Target' => 'presProps.xml' ) xml.Relationship( 'Id' => 'rId3', 'Type' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster', 'Target' => 'slideMasters/slideMaster1.xml' ) xml.Relationship( 'Id' => 'rId4', 'Type' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster', 'Target' => 'notesMasters/notesMaster1.xml' ) .each_with_index do |_, index| xml.Relationship( 'Id' => "rId#{5 + index + 1}", 'Type' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide', 'Target' => "slides/slide#{index + 1}.xml" ) end end end.to_xml end |