sablon 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sablon/parser/mail_merge.rb +6 -2
- data/lib/sablon/version.rb +1 -1
- data/test/mail_merge_parser_test.rb +33 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5407a184ceb161ef62b83c2df14b219cb6711f6b
|
4
|
+
data.tar.gz: fa4c9f089dc648d75ef8b2be51c53c5702c0541a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6da7577308e61e55a61c8f544ecc985d6c3f929d9adb47f07e7ff7fd2ba0e2aecf800765a55beb87434d19cfb096c569cc42e8ecacde6ad7adc2dbcc74830f6
|
7
|
+
data.tar.gz: 3810028838dc0b53deda64ff0d24e8773f917783092b3cce70d725d097a3e9104b63e1c98be3cf724342f57b9176fa99551a7f577ecc260ff7dfd4a1e622d567
|
data/Gemfile.lock
CHANGED
@@ -15,10 +15,14 @@ module Sablon
|
|
15
15
|
private
|
16
16
|
def replace_field_display(node, content)
|
17
17
|
paragraph = node.ancestors(".//w:p").first
|
18
|
-
display_node = node
|
18
|
+
display_node = get_display_node(node)
|
19
19
|
content.append_to(paragraph, display_node)
|
20
20
|
display_node.remove
|
21
21
|
end
|
22
|
+
|
23
|
+
def get_display_node(node)
|
24
|
+
node.search(".//w:t").first
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
class ComplexField < MergeField
|
@@ -28,7 +32,7 @@ module Sablon
|
|
28
32
|
end
|
29
33
|
|
30
34
|
def valid?
|
31
|
-
separate_node && expression
|
35
|
+
separate_node && get_display_node(pattern_node) && expression
|
32
36
|
end
|
33
37
|
|
34
38
|
def replace(content)
|
data/lib/sablon/version.rb
CHANGED
@@ -146,6 +146,39 @@ xml
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
+
class FldCharWithoutDisplayNodeTest < Sablon::TestCase
|
150
|
+
include SharedBehavior
|
151
|
+
|
152
|
+
def test_is_ignoredd
|
153
|
+
assert_equal [], fields.map(&:class)
|
154
|
+
end
|
155
|
+
|
156
|
+
private
|
157
|
+
def xml
|
158
|
+
xml = <<-xml.strip
|
159
|
+
<w:p>
|
160
|
+
<w:r w:rsidR="00AE229C">
|
161
|
+
<w:rPr></w:rPr>
|
162
|
+
<w:fldChar w:fldCharType="begin"/>
|
163
|
+
</w:r>
|
164
|
+
<w:r w:rsidR="00AE229C">
|
165
|
+
<w:rPr></w:rPr>
|
166
|
+
<w:instrText xml:space="preserve"> MERGEFIELD =client.lname \\* MERGEFORMAT </w:instrText>
|
167
|
+
</w:r>
|
168
|
+
<w:r w:rsidR="00AE229C">
|
169
|
+
<w:rPr></w:rPr>
|
170
|
+
<w:fldChar w:fldCharType="separate"/>
|
171
|
+
</w:r>
|
172
|
+
<w:r w:rsidR="00AE229C">
|
173
|
+
<w:rPr></w:rPr>
|
174
|
+
<w:fldChar w:fldCharType="end"/>
|
175
|
+
</w:r>
|
176
|
+
</w:p>
|
177
|
+
xml
|
178
|
+
wrap(xml)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
149
182
|
class NonSablonFieldTest < Sablon::TestCase
|
150
183
|
include SharedBehavior
|
151
184
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sablon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Senn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|