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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f9c6e50213d4168bcb01a3d4f4524e89b58aeced9f489e94f706bfa3370f962
4
- data.tar.gz: 9fc4ba9085fa62c3a77334bb1ba3d86f531f2f659feee2d6da73658557ad2874
3
+ metadata.gz: e265259007b2fafe480c9f56e959722bac46f9b1f77a11eea9b41e94d5879ee5
4
+ data.tar.gz: 8a9bac937d742a82b6d079f4f5f1cd0624c2a0858ba216ad2ed68ae99cb35923
5
5
  SHA512:
6
- metadata.gz: d8313334ab8ac9cb89e8ab962519f91a4bd7e8c6ad140a515c0a7d0dc25385d2b33115e9dd14cb63dfcd45d1633986c7cd242fb263c742d375baff04ef3ea6c7
7
- data.tar.gz: 161defb7c4e2d0d1008acf6eb435f3414ebef94580b41d89c294a0dedaa1d93a20bb7fbb9e3ba32f541e18e56b839848bf3d8fdd928fdb00efd58fde7004bdc0
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|&nbsp;/
74
+
75
+ # Replace non-breaking spaces with regular spaces, but only INSIDE Liquid tags (where they break
76
+ # parsing). Intentional &nbsp; 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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveEmailTemplates
2
- VERSION = '1.10.1'.freeze
2
+ VERSION = '1.10.2'.freeze
3
3
  end
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.1
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-06-11 00:00:00.000000000 Z
11
+ date: 2026-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails