txbr 2.5.2 → 2.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/txbr/template.rb +1 -1
- data/lib/txbr/version.rb +1 -1
- data/spec/template_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a33819dfb9210addc0b31bf40df318a0884dfd476d2f2c76ee81847a0c483b61
|
4
|
+
data.tar.gz: 92e410458f6786dfdaa03c08f96c85313b7f79b3820e3a46a93f0a4c23468bce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c3eab3a5bd77892765f01839a8b0bfaec22fc964113751487d851d6dcd8b4ab91bd2861dcc5bfad44b21af42bbd672eb2d6828fa12727dd2a882c7cd29d6b66
|
7
|
+
data.tar.gz: ced749251485e0fb2f0015aca96f9138219a22db044e63b6ef10b84e415b44e26555aac499bd734bbada6717610437bc3795681d376f6d360522938a68420ee8
|
data/lib/txbr/template.rb
CHANGED
@@ -69,7 +69,7 @@ module Txbr
|
|
69
69
|
# Otherwise, transform the var into something Liquid-friendly so it
|
70
70
|
# doesn't jam up the parser.
|
71
71
|
def prerender(source, variables)
|
72
|
-
source.gsub(
|
72
|
+
source.gsub(/(?:\{\s*\{\s*)?(?:[\w\-\_\.\[\]]+\.)?\$\{\s*[\w\-\.\[\]]+\s*\}?\s*(?:\}?\s*\})?/) do |orig|
|
73
73
|
plain = orig.sub(/\A\{\{/, '').sub(/\}\}\z/, '')
|
74
74
|
|
75
75
|
result = if val = variables[plain]
|
data/lib/txbr/version.rb
CHANGED
data/spec/template_spec.rb
CHANGED
@@ -10,6 +10,7 @@ describe Txbr::Template do
|
|
10
10
|
<h1>Braze campaign is {{campaign.${api_id}}}</h1>
|
11
11
|
<h2>Hello, {{${first_name}}}</h2>
|
12
12
|
<h3>I speak {{custom_attributes.${preferred_language} | default: 'en'}}</h3>
|
13
|
+
<h3>{{'foo bar ' | append: custom_attributes.${foobar}}}</h3>
|
13
14
|
SRC
|
14
15
|
end
|
15
16
|
|
@@ -17,7 +18,8 @@ describe Txbr::Template do
|
|
17
18
|
let(:prerender_variables) do
|
18
19
|
{
|
19
20
|
'campaign.${api_id}' => 'abc123',
|
20
|
-
'${first_name}' => 'Dwight'
|
21
|
+
'${first_name}' => 'Dwight',
|
22
|
+
'custom_attributes.${foobar}' => 'baz'
|
21
23
|
}
|
22
24
|
end
|
23
25
|
|
@@ -26,6 +28,7 @@ describe Txbr::Template do
|
|
26
28
|
<h1>Braze campaign is abc123</h1>
|
27
29
|
<h2>Hello, Dwight</h2>
|
28
30
|
<h3>I speak en</h3>
|
31
|
+
<h3>foo bar baz</h3>
|
29
32
|
TEXT
|
30
33
|
end
|
31
34
|
end
|
@@ -36,6 +39,7 @@ describe Txbr::Template do
|
|
36
39
|
<h1>Braze campaign is </h1>
|
37
40
|
<h2>Hello, </h2>
|
38
41
|
<h3>I speak en</h3>
|
42
|
+
<h3>foo bar </h3>
|
39
43
|
TEXT
|
40
44
|
end
|
41
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: txbr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abroad
|