standard-procedure-consolidate 0.1.3 → 0.1.4

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: b2d1794f2a364e867d285325c3a0dd9b5c6b4716145d5eaf964c91c44e937e5c
4
- data.tar.gz: 6622d19bc3de12fe8d77775b579c1531a057a27bacf227b0b119a252e7fd0003
3
+ metadata.gz: f45c16dc8e6f37f91043673804db8076030a804ab6c08fa1139f4d86cdf54b79
4
+ data.tar.gz: 7c77802d6b578ac50b9f9c8b5bad9ff097918fab5644eb3c771b2baf98451a36
5
5
  SHA512:
6
- metadata.gz: bb6944c739e5d772a45076b86f5c08d299913575027845ba505aa76b4ade18e3ecb47efe77f4499ac2a01f8782fcbf797b7dde9d00fb479716ac0b927288c9b4
7
- data.tar.gz: b9c10360e43007c6cd523ad238664786f2aa0884e524349d451989646e05f3f59569821e7361a8f4c553dad182ca61588629d108359b08953287bddf62f8533c
6
+ metadata.gz: 2ed822b460867d75395fdb9253ef3501619781d3ab31acaca7db4daf699658f8253d4a063336bcc2321bf6dd08f0207e91600172f8ec84e4263af055ee9107a7
7
+ data.tar.gz: 37a8f85beb0b9c65ba76bf9457edcb9e141d1e87aca1f65c01b5a4e43f45f143c66695d5922eb3ffafca43625f9e3745db8fd2e3c516dd6ffb73172a8c9437ac
@@ -0,0 +1,3 @@
1
+ {
2
+
3
+ }
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.1.4] - 2023-09-11
2
+
3
+ Updated which files get exclusions after crashes in production with some client files
4
+
1
5
  ## [0.1.3] - 2023-09-07
2
6
 
3
7
  Customer had an issue where some fields were not merging correctly
@@ -21,6 +25,3 @@ Customer had an issue where some fields were not merging correctly
21
25
  - Initial release
22
26
 
23
27
  ## [Unreleased]
24
-
25
-
26
-
data/README.md CHANGED
@@ -17,7 +17,7 @@ To list the merge fields within a document:
17
17
 
18
18
  ```ruby
19
19
  Consolidate::Docx::Merge.open "/path/to/docx" do |merge|
20
- puts merge.examine
20
+ merge.examine
21
21
  end and nil
22
22
  ```
23
23
  To perform a merge, replacing merge fields with supplied values:
@@ -31,6 +31,18 @@ end
31
31
 
32
32
  NOTE: The merge fields are case-sensitive - which is why they should be supplied as strings (using the older `{ "key" => "value" }` style ruby hash).
33
33
 
34
+ If your merge isn't working, you can pass `verbose: true` to `open` and it will list the internal .xml documents it finds, the fields it finds within those .xml documents and the substitutions it is trying to perform.
35
+
36
+ ## How it works
37
+
38
+ This is a bit sketchy and pieced together from the [code I found]((https://gist.github.com/ericmason/7200448)) and various bits of skimming through the published file format.
39
+
40
+ A .docx file (unlike the previous .doc file), is actually a .zip file that contains a number of .xml files. The contents of the document are stored in these .xml files, along with configuration information and stuff like fonts and styles.
41
+
42
+ When setting up a merge field, Word adds some special tags into the .xml file. There appear to be two different versions of how it does this - using `w:fldSimple` or `w:instrText` tags. Consolidate goes through each .xml file within the document (ignoring some which are configuration related) and looks for these two types of tag.
43
+
44
+ The `data` method uses the hash of `field: value` data you supply, copies the .xml files and performs a straight text substitution on any matching merge fields. Then `write_to`
45
+
34
46
  ## Development
35
47
 
36
48
  The repo contains a .devcontainer folder - this contains instructions for a development container that has everything needed to build the project. Once the container has started, you can use `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1 @@
1
+ da681c73463215031518b2606899503d3217ab92e1877bd8f966e5dc3ebc971ae686958b78da821feb24374f84d179e86cdaf29dbb90f0bacb0a7cbde8e66c6b
@@ -46,8 +46,6 @@ module Consolidate
46
46
  attr_reader :documents
47
47
  attr_accessor :output
48
48
 
49
- EXCLUSIONS = %w{_rels/.rels [Content_Types].xml word/_rels/document.xml.rels word/theme/theme1.xml word/settings.xml word/_rels/settings.xml.rels word/styles.xml word/webSettings.xml word/fontTable.xml docProps/core.xml docProps/app.xml}
50
-
51
49
  def initialize(path, verbose: false, &block)
52
50
  raise "No block given" unless block
53
51
  @verbose = verbose
@@ -56,7 +54,7 @@ module Consolidate
56
54
  begin
57
55
  @zip = Zip::File.open(path)
58
56
  @zip.entries.each do |entry|
59
- next if EXCLUSIONS.include? entry.name
57
+ next unless entry.name =~ /word\/(document|header|footer|footnotes|endnotes).?\.xml/
60
58
  puts "Reading #{entry.name}" if verbose
61
59
  xml = @zip.get_input_stream entry
62
60
  @documents[entry.name] = Nokogiri::XML(xml) { |x| x.noent }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Consolidate
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard-procedure-consolidate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahoul Baruah
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-07 00:00:00.000000000 Z
11
+ date: 2023-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -47,6 +47,7 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - ".devcontainer/devcontainer.json"
50
+ - ".nova/Configuration.json"
50
51
  - ".rspec"
51
52
  - ".ruby-version"
52
53
  - ".standard.yml"
@@ -58,6 +59,7 @@ files:
58
59
  - checksums/standard-procedure-consolidate-0.1.0.gem.sha512
59
60
  - checksums/standard-procedure-consolidate-0.1.2.gem.sha512
60
61
  - checksums/standard-procedure-consolidate-0.1.3.gem.sha512
62
+ - checksums/standard-procedure-consolidate-0.1.4.gem.sha512
61
63
  - exe/consolidate
62
64
  - lib/consolidate.rb
63
65
  - lib/consolidate/docx/merge.rb