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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71db0768a21fe9c99eaca1fe8835db8f0619530f3b111fc767afd1bbd15c5da5
4
- data.tar.gz: 46507a64f582f7f6486556ab68e26baf93a4d3c1353293b0c1aa9068cbe9a0cf
3
+ metadata.gz: f27dd06895b320a411d00a17cdd4135681e76e2a49e366b607b4afa521d0867b
4
+ data.tar.gz: 07a866bd7de92a6e50fd4be479576a77de79edfede68d5a9e0b05b7b16fada9b
5
5
  SHA512:
6
- metadata.gz: eaecad61bffa383575bc36536ac8c39d66e745e22fd2b26f509f39325b1faeecb66904ac9184b179e3e27883065ebd7dfe982667bb68c9b6cbdb7dfacb866055
7
- data.tar.gz: 1bd65897a04c0a22ff34b7d1224c8d39a1421219d4d6e4abf7e187bd14764e493c72fb205a7b4f33699866d1f018d5c420989123b6a05542e57c962acb83721b
6
+ metadata.gz: f5563cc357c8aa8618b854fdf9073393494c98e6a132600c682b7b26b909119af91c553796b17c70f09cbed5582f139f0c5ed9c6a3820b73c5c131b02120bf95
7
+ data.tar.gz: '08f10d16e93ee74c01dbb1ce35fc8f5ea6b91a63e2c95d3abca1c72b72f758ce0703b2e4270ae3844d2d1f976582d31280bd5678447a1fd480597afc602f8fe2'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.7
4
+
5
+ Feature:
6
+
7
+ - Add ability to inline highlight parts
8
+
9
+ ## 0.1.6
10
+
11
+ Bugfix:
12
+
13
+ - Stop additional page being added after content. Add known issue.
14
+
3
15
  ## 0.1.5
4
16
 
5
17
  Bugfix:
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>.
@@ -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] || :portrait
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] || :portrait
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:p>
30
- <w:pPr>
31
- <w:sectPr>
32
- <w:pgSz w:w="#{@width}" w:h="#{@height}" w:orient="#{@orientation}"/>
33
- <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]}"/>
34
- <w:cols w:space="708"/>
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")}
@@ -1,3 +1,3 @@
1
1
  module DocXify
2
- VERSION = "0.1.5".freeze
2
+ VERSION = "0.1.7".freeze
3
3
  end
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.5
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: 2024-09-24 00:00:00.000000000 Z
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.17
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.