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 +4 -4
- data/changelog.md +3 -0
- data/docstache.gemspec +1 -0
- data/lib/docstache.rb +5 -6
- data/lib/docstache/document.rb +7 -5
- data/lib/docstache/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebc3b1a35a807456664b2f75b8f636fc7417075f
|
4
|
+
data.tar.gz: 92fb9f96b317ed48ccdd9b10b889116bef154abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a4830e510ea526919d69734b496767c596869e014cf775563c86dd7d84a52687ebfb6fd98eb0d56f927412dfb28aff5a314ae19cf7ac7b919d2144a2ab0dc4a
|
7
|
+
data.tar.gz: 3a09c43efa037551271a60c8c7c704e7d954288c7ffbc176740bae2cde8238d3c96b5c43bfad86fad50bbb8c2706120f32a86e25a31c2181b741694ed5f5cd81
|
data/changelog.md
CHANGED
@@ -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}}`
|
data/docstache.gemspec
CHANGED
data/lib/docstache.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
require 'zip'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
data/lib/docstache/document.rb
CHANGED
@@ -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
|
data/lib/docstache/version.rb
CHANGED
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.
|
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:
|
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
|