docxify 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c43501f65a265d3e8ce49ae0c5081d425c838465e31392b8e17c66c5d32214f9
4
- data.tar.gz: efff6888d11c6ba8d9984150c0589d57e960b0e04fdc3daa79a2a458517b0fdd
3
+ metadata.gz: 897b2f634b40161a9795499ceb4324d568792267e7e20ac0017c606cf9f42a47
4
+ data.tar.gz: 99f727d9d8b1d5063d9c290606911f45bdce092d83ede247fab952a112c72fae
5
5
  SHA512:
6
- metadata.gz: c8dae5642665518f3c8be12d9a3d16a54ab626e3601b0b1073583f5c6f67cc80e31215e045f9ce593e520db7e35349d55363fee1f4713be4bb8eb7a704081780
7
- data.tar.gz: 2d6aca43dba5dbe008f58e83a7bac426d6edb43aac83ba9812dc3eb1ab9bbe9218d128f88d6dfbd78fafaef38f8be32b1a97a47ba1519d13f4c86b81417c62c7
6
+ metadata.gz: '051835c221e1d60bf40e9ee2020ad0bb4682d67fcc3beea6f92ba80380ef0177ef7365b24562d1f19294c72fddfb83ddf860409fe835888b3682277aaf79a318'
7
+ data.tar.gz: 2f21816e06987a0650c4ab1f5c0628e8eccc77be64fe1bbee35f8a40ed1aede60a95d4bf8fba7bb7ce509feb394c6a1004266541f154a43bc2372a56578b9b17
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.0
4
+
5
+ Features:
6
+
7
+ - Implemented Document#bounds_width and Document#bounds_height
8
+
9
+ ## 0.0.9
10
+
11
+ Features:
12
+
13
+ - Fixed page layout loading
14
+
3
15
  ## 0.0.8
4
16
 
5
17
  Features:
@@ -16,6 +16,14 @@ module DocXify
16
16
  @margins = { top: 2, bottom: 2, left: 2, right: 2 }.merge(options[:margins] || {})
17
17
  end
18
18
 
19
+ def bounds_width
20
+ @page_layout&.bounds_width || (@width - @margins[:left] - @margins[:right])
21
+ end
22
+
23
+ def bounds_height
24
+ @page_layout&.bounds_height || (@height - @margins[:top] - @margins[:bottom])
25
+ end
26
+
19
27
  def default_styling(options = {})
20
28
  @font = options[:font] if options[:font]
21
29
  @size = options[:size] if options[:size]
@@ -89,7 +97,8 @@ module DocXify
89
97
 
90
98
  def add_page_layout(options = {})
91
99
  options[:document] = self
92
- add DocXify::Element::PageLayout.new(options)
100
+ @page_layout = DocXify::Element::PageLayout.new(options)
101
+ add @page_layout
93
102
  end
94
103
 
95
104
  def add_divider
@@ -15,6 +15,15 @@ module DocXify
15
15
  @orientation = options[:orientation] || :portrait
16
16
  end
17
17
 
18
+ # Don't consider this part of the public API, they're used by Document if it's been created
19
+ def bounds_width
20
+ @width - @margins[:left] - @margins[:right]
21
+ end
22
+
23
+ def bounds_height
24
+ @height - @margins[:top] - @margins[:bottom]
25
+ end
26
+
18
27
  def to_s(_container = nil)
19
28
  <<~XML
20
29
  <w:p>
@@ -1,3 +1,3 @@
1
1
  module DocXify
2
- VERSION = "0.0.9".freeze
2
+ VERSION = "0.1.0".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.9
4
+ version: 0.1.0
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-08-23 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip