docstache 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 3b400a5b0a023a3d6a9deb3835faff68ee17a5d7
4
- data.tar.gz: 59c5ff97e4c9f34aad5c38a793bf937efcf4aa80
3
+ metadata.gz: ebc3b1a35a807456664b2f75b8f636fc7417075f
4
+ data.tar.gz: 92fb9f96b317ed48ccdd9b10b889116bef154abf
5
5
  SHA512:
6
- metadata.gz: 2130ef05930e66377c40bae00a9dabb56c9a247c8f86de787881630b02f76bc669c59ced04108091f8ec24646dc80fb286dbab5933527a0325952bb93c9f9c68
7
- data.tar.gz: 7bf46117d6252fe7dbbeb729a94a459ed24c8968b7746102006df2e11ff7e75f4a379a4818575878155cfbcdb2cad3bb360b81be80e55c3c79becfdb88e0d86b
6
+ metadata.gz: 8a4830e510ea526919d69734b496767c596869e014cf775563c86dd7d84a52687ebfb6fd98eb0d56f927412dfb28aff5a314ae19cf7ac7b919d2144a2ab0dc4a
7
+ data.tar.gz: 3a09c43efa037551271a60c8c7c704e7d954288c7ffbc176740bae2cde8238d3c96b5c43bfad86fad50bbb8c2706120f32a86e25a31c2181b741694ed5f5cd81
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1
4
+ * [25b4c2e9e3dcb19b6fe9a255fec2c2bfd92029a6] Fixed a bug where a tag with regular expression characters could not be fixed with the `fix_errors` method
5
+
3
6
  ## 0.2.0
4
7
 
5
8
  * [902d9890bee1a20a90377a94c3096a51781e8a24] You can access array elements with `[]`s within a `{{tag}}`
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency 'rubyzip', '~> 1.1'
22
22
 
23
23
  s.add_development_dependency 'rspec', '~> 3.1.0'
24
+ s.add_development_dependency 'pry-byebug', '~> 1'
24
25
  end
@@ -1,11 +1,10 @@
1
1
  require 'nokogiri'
2
2
  require 'zip'
3
-
4
- require_relative "docstache/version"
5
- require_relative "docstache/data_scope"
6
- require_relative "docstache/block"
7
- require_relative "docstache/renderer"
8
- require_relative "docstache/document"
3
+ require "docstache/version"
4
+ require "docstache/data_scope"
5
+ require "docstache/document"
6
+ require "docstache/block"
7
+ require "docstache/renderer"
9
8
 
10
9
  module Docstache
11
10
  #noop
@@ -24,11 +24,6 @@ module Docstache
24
24
  end
25
25
 
26
26
  def fix_errors
27
- missing_tags = tags - usable_tags
28
- problem_paragraphs = missing_tags.map { |tag|
29
- @document.css('w|p').select {|t| t.text =~ /#{tag}/}.first
30
- }
31
-
32
27
  problem_paragraphs.each do |p|
33
28
  flatten_paragraph(p) if p
34
29
  end
@@ -58,6 +53,13 @@ module Docstache
58
53
 
59
54
  private
60
55
 
56
+ def problem_paragraphs
57
+ missing_tags = tags - usable_tags
58
+ missing_tags.flat_map do |tag|
59
+ @document.css('w|p').select {|t| t.text =~ /#{Regexp.escape(tag)}/}
60
+ end
61
+ end
62
+
61
63
  def flatten_paragraph(p)
62
64
  runs = p.css('w|r')
63
65
  host_run = runs.shift
@@ -1,3 +1,3 @@
1
1
  module Docstache
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docstache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Cosgrove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2016-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
55
69
  description: Integrates data into MS Word docx template files. Processing supports
56
70
  loops and replacement of strings of data both outside and within loops.
57
71
  email:
@@ -100,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
114
  version: '0'
101
115
  requirements: []
102
116
  rubyforge_project:
103
- rubygems_version: 2.4.5
117
+ rubygems_version: 2.4.5.1
104
118
  signing_key:
105
119
  specification_version: 4
106
120
  summary: Merges Hash of Data into Word docx template files using mustache syntax