docxify 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ce756578c53df736bb1a6641722c8915ccc6bfdf24ce19c21e4bd64624f8405
4
- data.tar.gz: 62039225ee265819d72a6cd6ef64a6cd7150b89d99f93fc1a0dfcf7994cafa4c
3
+ metadata.gz: c43501f65a265d3e8ce49ae0c5081d425c838465e31392b8e17c66c5d32214f9
4
+ data.tar.gz: efff6888d11c6ba8d9984150c0589d57e960b0e04fdc3daa79a2a458517b0fdd
5
5
  SHA512:
6
- metadata.gz: 514adbdd7c383dc3a373f460b9c548b532e3885b16d75030e5a12e070a13d41e3addab9cbed4cd89794e2bb057e67599e44d1399981d5a6e94c9fb1c5747dc6c
7
- data.tar.gz: d3d04f7f8ad20fcdc4478cfe07247f4dc1d687423d4df46336ffd742cbbf941846e8831b8344279db182c324e3eac515856937152162be89f84590c095d80f14
6
+ metadata.gz: c8dae5642665518f3c8be12d9a3d16a54ab626e3601b0b1073583f5c6f67cc80e31215e045f9ce593e520db7e35349d55363fee1f4713be4bb8eb7a704081780
7
+ data.tar.gz: 2d6aca43dba5dbe008f58e83a7bac426d6edb43aac83ba9812dc3eb1ab9bbe9218d128f88d6dfbd78fafaef38f8be32b1a97a47ba1519d13f4c86b81417c62c7
data/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Features:
6
6
 
7
- - Allow changing of following section's page layotu
7
+ - Allow changing of following section's page layout
8
8
 
9
9
  ## 0.0.7
10
10
 
@@ -0,0 +1,34 @@
1
+ # Word PageLayouts are a weird concept; instead of a wrapping element or a
2
+ # "this applies to content from here on down", it's applied retrospectively
3
+ # to the content that came before it.
4
+ module DocXify
5
+ module Element
6
+ class PageLayout < Base
7
+ attr_accessor :width, :height, :orientation
8
+
9
+ def initialize(options = {})
10
+ super()
11
+ @document = options[:document]
12
+ @margins = @document.margins
13
+ @width = options[:width] || @document&.width || DocXify::A4_PORTRAIT_WIDTH
14
+ @height = options[:height] || @document&.height || DocXify::A4_PORTRAIT_HEIGHT
15
+ @orientation = options[:orientation] || :portrait
16
+ end
17
+
18
+ def to_s(_container = nil)
19
+ <<~XML
20
+ <w:p>
21
+ <w:pPr>
22
+ <w:sectPr>
23
+ <w:pgSz w:w="#{@width}" w:h="#{@height}" w:orient="#{@orientation}"/>
24
+ <w:pgMar w:bottom="#{DocXify.cm2dxa @margins[:bottom]}" w:footer="708" w:gutter="0" w:header="708" w:left="#{DocXify.cm2dxa @margins[:left]}" w:right="#{DocXify.cm2dxa @margins[:right]}" w:top="#{DocXify.cm2dxa @margins[:top]}"/>
25
+ <w:cols w:space="708"/>
26
+ <w:docGrid w:linePitch="360"/>
27
+ </w:sectPr>
28
+ </w:pPr>
29
+ </w:p>
30
+ XML
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module DocXify
2
- VERSION = "0.0.8".freeze
2
+ VERSION = "0.0.9".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docxify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -46,6 +46,7 @@ files:
46
46
  - lib/docxify/element/file.rb
47
47
  - lib/docxify/element/image.rb
48
48
  - lib/docxify/element/page_break.rb
49
+ - lib/docxify/element/page_layout.rb
49
50
  - lib/docxify/element/paragraph.rb
50
51
  - lib/docxify/element/table.rb
51
52
  - lib/docxify/element/table_cell.rb
@@ -74,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  requirements: []
77
- rubygems_version: 3.5.6
78
+ rubygems_version: 3.5.17
78
79
  signing_key:
79
80
  specification_version: 4
80
81
  summary: DocXify is a gem to help you generate Word documents from Ruby.