effective_email_templates 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/effective/email_template.rb +20 -0
- data/lib/effective_email_templates/version.rb +1 -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: e265259007b2fafe480c9f56e959722bac46f9b1f77a11eea9b41e94d5879ee5
|
|
4
|
+
data.tar.gz: 8a9bac937d742a82b6d079f4f5f1cd0624c2a0858ba216ad2ed68ae99cb35923
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c98ecaf4da1fc6fac0ee0445c1b950cce5bcefe4e7354cac792733fbdcf04fd0a56a9c741958868d0c6d23c289a67a67c2061ba7a13856d6f53e1af9c7aa0b52
|
|
7
|
+
data.tar.gz: 061054eb457b4afe9455ba79f5596df8e840f5f92c89323155f34032ea79634c48b9f4dcc5260bf424b9061ac448baae4b93f1064ff66993f8ecd3f8e1c6b7af
|
|
@@ -35,6 +35,16 @@ module Effective
|
|
|
35
35
|
assign_attributes(body: html)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
# A non-breaking space inside a Liquid tag - e.g. "{{ reason }}" pasted or round-tripped through
|
|
39
|
+
# a WYSIWYG editor as "{{ reason }}" - stops Liquid from parsing the variable, so it renders
|
|
40
|
+
# blank instead of its value. Normalize any entity or U+00A0 char that lands INSIDE a
|
|
41
|
+
# {{ }} / {% %} tag back to a regular space. Runs before the liquid validation so the cleaned
|
|
42
|
+
# value is what gets parsed, stored, and imported.
|
|
43
|
+
before_validation do
|
|
44
|
+
self.body = strip_liquid_nbsp(body)
|
|
45
|
+
self.subject = strip_liquid_nbsp(subject)
|
|
46
|
+
end
|
|
47
|
+
|
|
38
48
|
validates :body, liquid: true
|
|
39
49
|
validates :subject, liquid: true
|
|
40
50
|
|
|
@@ -59,6 +69,16 @@ module Effective
|
|
|
59
69
|
body.present? && !(body.include?('</p>') || body.include?('</div>'))
|
|
60
70
|
end
|
|
61
71
|
|
|
72
|
+
LIQUID_TAG = /\{\{.*?\}\}|\{%.*?%\}/m
|
|
73
|
+
NBSP = /\u00A0| /
|
|
74
|
+
|
|
75
|
+
# Replace non-breaking spaces with regular spaces, but only INSIDE Liquid tags (where they break
|
|
76
|
+
# parsing). Intentional elsewhere in the template's HTML is left untouched.
|
|
77
|
+
def strip_liquid_nbsp(value)
|
|
78
|
+
return value if value.blank?
|
|
79
|
+
value.gsub(LIQUID_TAG) { |tag| tag.gsub(NBSP, ' ') }
|
|
80
|
+
end
|
|
81
|
+
|
|
62
82
|
def render(assigns = {})
|
|
63
83
|
assigns = deep_stringify_assigns(assigns)
|
|
64
84
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_email_templates
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.10.
|
|
4
|
+
version: 1.10.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|