docxify 0.1.5 → 0.1.7
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +4 -0
- data/lib/docxify/document.rb +1 -1
- data/lib/docxify/element/page_layout.rb +7 -11
- data/lib/docxify/element/paragraph.rb +1 -1
- data/lib/docxify/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f27dd06895b320a411d00a17cdd4135681e76e2a49e366b607b4afa521d0867b
|
4
|
+
data.tar.gz: 07a866bd7de92a6e50fd4be479576a77de79edfede68d5a9e0b05b7b16fada9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5563cc357c8aa8618b854fdf9073393494c98e6a132600c682b7b26b909119af91c553796b17c70f09cbed5582f139f0c5ed9c6a3820b73c5c131b02120bf95
|
7
|
+
data.tar.gz: '08f10d16e93ee74c01dbb1ce35fc8f5ea6b91a63e2c95d3abca1c72b72f758ce0703b2e4270ae3844d2d1f976582d31280bd5678447a1fd480597afc602f8fe2'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -90,6 +90,10 @@ The main object created by users is a `DocXify::Document`. This builds up a `@co
|
|
90
90
|
|
91
91
|
The `render` method on a `DocXify::Document` will generate a complete `document.xml` (Word terminology not a Ruby method) by creating a template and iterating each `@content` item. It will then create a `DocXify::Container` with that `document.xml` to generate a complete Zipped DocX file, and call it's `render` method to generate an in-memory file. This is then either returned to the `render` caller, or if a file path was passed as the first attribute, then it writes it out.
|
92
92
|
|
93
|
+
### Known issues
|
94
|
+
|
95
|
+
The only known issue is that it doesn't like mixing and matching page orientations. If you start a document as portrait or landscape, it's fine, but it really doesn't like a single page being in a different orientation.
|
96
|
+
|
93
97
|
## Contributing
|
94
98
|
|
95
99
|
Bug reports and pull requests are welcome on GitHub at <https://github.com/foundercatalyst/docxify>.
|
data/lib/docxify/document.rb
CHANGED
@@ -8,7 +8,7 @@ module DocXify
|
|
8
8
|
@relationships = []
|
9
9
|
@width = options[:width] || A4_PORTRAIT_WIDTH
|
10
10
|
@height = options[:height] || A4_PORTRAIT_HEIGHT
|
11
|
-
@orientation = options[:orientation]
|
11
|
+
@orientation = options[:orientation]
|
12
12
|
@font = options[:font] || "Times New Roman"
|
13
13
|
@size = options[:size] || 12
|
14
14
|
@color = options[:color] || 12
|
@@ -12,7 +12,7 @@ module DocXify
|
|
12
12
|
@margins = @document.margins
|
13
13
|
@width = options[:width] || @document&.width || DocXify::A4_PORTRAIT_WIDTH
|
14
14
|
@height = options[:height] || @document&.height || DocXify::A4_PORTRAIT_HEIGHT
|
15
|
-
@orientation = options[:orientation]
|
15
|
+
@orientation = options[:orientation]
|
16
16
|
end
|
17
17
|
|
18
18
|
# Don't consider this part of the public API, they're used by Document if it's been created
|
@@ -26,16 +26,12 @@ module DocXify
|
|
26
26
|
|
27
27
|
def to_s(_container = nil)
|
28
28
|
<<~XML
|
29
|
-
<w:
|
30
|
-
<w:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
<w:docGrid w:linePitch="360"/>
|
36
|
-
</w:sectPr>
|
37
|
-
</w:pPr>
|
38
|
-
</w:p>
|
29
|
+
<w:sectPr>
|
30
|
+
<w:pgSz w:w="#{@width}" w:h="#{@height}" #{'w:orient="portrait}"' if @orientation.to_s == "portrait"} #{'w:orient="landscape}"' if @orientation.to_s == "landscape"} />
|
31
|
+
<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]}"/>
|
32
|
+
<w:cols w:space="708"/>
|
33
|
+
<w:docGrid w:linePitch="360"/>
|
34
|
+
</w:sectPr>
|
39
35
|
XML
|
40
36
|
end
|
41
37
|
end
|
@@ -59,7 +59,7 @@ module DocXify
|
|
59
59
|
<w:color w:val="#{@color.gsub("#", "")}"/>
|
60
60
|
<w:sz w:val="#{DocXify.pt2halfpt(@size)}"/>
|
61
61
|
<w:szCs w:val="#{DocXify.pt2halfpt(@size)}"/>
|
62
|
-
#{"<w:highlight w:val=\"yellow\"/>" if @highlight}
|
62
|
+
#{"<w:highlight w:val=\"yellow\"/>" if @highlight || (node.is_a?(Hash) && node[:tag].match?("mark"))}
|
63
63
|
#{"<w:b/><w:bCs/>" if node.is_a?(Hash) && node[:tag].match?("b")}
|
64
64
|
#{"<w:i/><w:iCs/>" if node.is_a?(Hash) && node[:tag].match?("i")}
|
65
65
|
#{"<w:u w:val=\"single\"/>" if node.is_a?(Hash) && (node[:tag].match?("u") || node[:tag] == "a")}
|
data/lib/docxify/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docxify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: image_size
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
rubygems_version: 3.5.
|
93
|
+
rubygems_version: 3.5.21
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: DocXify is a gem to help you generate Word documents from Ruby.
|