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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/docxify/document.rb +10 -1
- data/lib/docxify/element/page_layout.rb +9 -0
- data/lib/docxify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 897b2f634b40161a9795499ceb4324d568792267e7e20ac0017c606cf9f42a47
|
4
|
+
data.tar.gz: 99f727d9d8b1d5063d9c290606911f45bdce092d83ede247fab952a112c72fae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '051835c221e1d60bf40e9ee2020ad0bb4682d67fcc3beea6f92ba80380ef0177ef7365b24562d1f19294c72fddfb83ddf860409fe835888b3682277aaf79a318'
|
7
|
+
data.tar.gz: 2f21816e06987a0650c4ab1f5c0628e8eccc77be64fe1bbee35f8a40ed1aede60a95d4bf8fba7bb7ce509feb394c6a1004266541f154a43bc2372a56578b9b17
|
data/CHANGELOG.md
CHANGED
data/lib/docxify/document.rb
CHANGED
@@ -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
|
-
|
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>
|
data/lib/docxify/version.rb
CHANGED
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
|
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-
|
11
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|