docxify 0.1.9 → 0.1.10
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/.ruby-version +1 -0
- data/CHANGELOG.md +9 -0
- data/README.md +2 -2
- data/lib/docxify/document.rb +2 -2
- data/lib/docxify/element/page_layout.rb +1 -1
- data/lib/docxify/version.rb +1 -1
- data/lib/docxify.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 468ed63c77e6e9759f3310c7b3a45dbfb45437529d39193d4b138998f5ad065a
|
|
4
|
+
data.tar.gz: f59112b36b5d2db86eff32e74dd7184cace6fa40da156bba18eda6871914c9e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9e3f0ad21d53586647982b41dd08ba72f667121ff39b2cce7c47cf1540b3e7a48e1456fbb621ecef0b96aae825d7b8ec2b4899898fd42381a9211b540335d58
|
|
7
|
+
data.tar.gz: 3ea81df4409e565b5e3bfdd6247b5f82296e9bf2334e8bad85de94f4d070754488bf47e7bcb2e6fa395a753622e14daa5d658355183c8d4a67b19063e8161e35
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.1.10
|
|
4
|
+
|
|
5
|
+
Bugfix:
|
|
6
|
+
|
|
7
|
+
- `A4_PORTRAIT_HEIGHT` (and so `A4_LANDSCAPE_WIDTH`) was 15840 twips, which is US Letter's 11 inches; it is now A4's 16838, so documents using the default page size come out on A4
|
|
8
|
+
- `w:orient` was written as `"portrait}"` / `"landscape}"` (stray brace), and the `orientation:` passed to `Document.new` was never written at all
|
|
9
|
+
- `Document#height` reader added, so `add_page_layout` without an explicit `height:` no longer raises `NoMethodError`
|
|
10
|
+
- README showed `page_width:`/`page_height:` (ignored; the options are `width:`/`height:`) and `page_layout` instead of `add_page_layout`
|
|
11
|
+
|
|
3
12
|
## 0.1.9
|
|
4
13
|
|
|
5
14
|
Security:
|
data/README.md
CHANGED
|
@@ -19,7 +19,7 @@ gem install docxify
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
21
|
```ruby
|
|
22
|
-
@docx = DocXify::Document.new(
|
|
22
|
+
@docx = DocXify::Document.new(width: DocXify::A4_PORTRAIT_WIDTH, height: DocXify::A4_PORTRAIT_HEIGHT)
|
|
23
23
|
|
|
24
24
|
@docx.default_styling font: "Serif font here", size: 14, color: "#040404"
|
|
25
25
|
|
|
@@ -41,7 +41,7 @@ gem install docxify
|
|
|
41
41
|
|
|
42
42
|
@docx.add_page_break
|
|
43
43
|
|
|
44
|
-
@docx.
|
|
44
|
+
@docx.add_page_layout width: DocXify::A4_PORTRAIT_HEIGHT, height: DocXify::A4_PORTRAIT_WIDTH, orientation: :landscape
|
|
45
45
|
|
|
46
46
|
rows = []
|
|
47
47
|
rows << [
|
data/lib/docxify/document.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module DocXify
|
|
2
2
|
class Document
|
|
3
3
|
attr_accessor :font, :size, :color, :background, :margins, :page_layout
|
|
4
|
-
attr_reader :content, :relationships, :width
|
|
4
|
+
attr_reader :content, :relationships, :width, :height
|
|
5
5
|
|
|
6
6
|
def initialize(options = {})
|
|
7
7
|
@content = []
|
|
@@ -51,7 +51,7 @@ module DocXify
|
|
|
51
51
|
XML
|
|
52
52
|
|
|
53
53
|
# See the note in DocXify::Element::PageLayout for why it's not just handled the same as any other element
|
|
54
|
-
@page_layout = DocXify::Element::PageLayout.new(width: @width, height: @height, orientation: @
|
|
54
|
+
@page_layout = DocXify::Element::PageLayout.new(width: @width, height: @height, orientation: @orientation, document: self)
|
|
55
55
|
|
|
56
56
|
@content.each do |element|
|
|
57
57
|
if element.is_a?(DocXify::Element::PageLayout)
|
|
@@ -27,7 +27,7 @@ module DocXify
|
|
|
27
27
|
def to_s(_container = nil)
|
|
28
28
|
<<~XML
|
|
29
29
|
<w:sectPr>
|
|
30
|
-
<w:pgSz w:w="#{@width}" w:h="#{@height}" #{'w:orient="portrait
|
|
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
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
32
|
<w:cols w:space="708"/>
|
|
33
33
|
<w:docGrid w:linePitch="360"/>
|
data/lib/docxify/version.rb
CHANGED
data/lib/docxify.rb
CHANGED
|
@@ -19,7 +19,7 @@ module DocXify
|
|
|
19
19
|
|
|
20
20
|
UNITS_PER_CM = (1440 / 2.54)
|
|
21
21
|
A4_PORTRAIT_WIDTH = 11_906 # cm2dxa(21)
|
|
22
|
-
A4_PORTRAIT_HEIGHT =
|
|
22
|
+
A4_PORTRAIT_HEIGHT = 16_838 # cm2dxa(29.7)
|
|
23
23
|
A4_LANDSCAPE_WIDTH = A4_PORTRAIT_HEIGHT
|
|
24
24
|
A4_LANDSCAPE_HEIGHT = A4_PORTRAIT_WIDTH
|
|
25
25
|
|
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.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Jeffries
|
|
@@ -48,6 +48,7 @@ extra_rdoc_files: []
|
|
|
48
48
|
files:
|
|
49
49
|
- ".rspec"
|
|
50
50
|
- ".rubocop.yml"
|
|
51
|
+
- ".ruby-version"
|
|
51
52
|
- CHANGELOG.md
|
|
52
53
|
- LICENSE.md
|
|
53
54
|
- README.md
|
|
@@ -88,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
88
89
|
- !ruby/object:Gem::Version
|
|
89
90
|
version: '0'
|
|
90
91
|
requirements: []
|
|
91
|
-
rubygems_version:
|
|
92
|
+
rubygems_version: 4.0.10
|
|
92
93
|
specification_version: 4
|
|
93
94
|
summary: DocXify is a gem to help you generate Word documents from Ruby.
|
|
94
95
|
test_files: []
|