zendesk_apps_support 4.6.0 → 4.6.1
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/lib/zendesk_apps_support/validations/svg.rb +19 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2606213b113bb33822d480147204c96413ca811f
|
4
|
+
data.tar.gz: a75bceb9a99922779a630a6788ef85d6c2ca3556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4065b212cb191878ca73eb4404117d25eb3079fe1635e7f870eff0c92d8db85a7351dcd66bc664e856298c97aef32090d2d95fdabf1f6a13744fa4cebc30d2c7
|
7
|
+
data.tar.gz: 37bb13b7f53c1fd2f06dc05b683a4eacd9b0b5976b45442f111afd4ff2e5514ab3f7639316d948748aa1f2e84b50cd1747cf8da12722e65c1e0d5cdd73b251b8
|
@@ -4,25 +4,32 @@ require 'loofah'
|
|
4
4
|
module ZendeskAppsSupport
|
5
5
|
module Validations
|
6
6
|
module Svg
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
@empty_malformed_markup = Loofah::Scrubber.new do |node|
|
12
|
-
node.next.remove while node.name == 'svg' && node.next
|
13
|
-
end
|
7
|
+
# whitelist elements and attributes used in Zendesk Garden assets
|
8
|
+
Loofah::HTML5::WhiteList::ALLOWED_ELEMENTS_WITH_LIBXML2.add 'symbol'
|
9
|
+
Loofah::HTML5::WhiteList::ACCEPTABLE_CSS_PROPERTIES.add 'position'
|
14
10
|
|
15
11
|
# CRUFT: ignore a (very specific) style attribute which Loofah would otherwise scrub.
|
16
12
|
# This attribute is deprecated (https://www.w3.org/TR/filter-effects/#AccessBackgroundImage)
|
17
13
|
# but is included in many of the test apps used in fixtures for tests in ZAM, ZAT etc.
|
18
|
-
|
19
|
-
|
14
|
+
Loofah::HTML5::WhiteList::ACCEPTABLE_CSS_PROPERTIES.add 'enable-background'
|
15
|
+
|
16
|
+
@strip_declaration = Loofah::Scrubber.new do |node|
|
17
|
+
node.remove if node.name == 'xml' && node.children.empty?
|
18
|
+
end
|
19
|
+
|
20
|
+
# Loofah's default scrubber strips spaces between CSS attributes. Passing the input markup through this scrubber
|
21
|
+
# first ensures that this stripped whitespace in the output doesn't register as a diff.
|
22
|
+
@strip_spaces_between_css_attrs = Loofah::Scrubber.new do |node|
|
23
|
+
match_pattern = Regexp.new(/\;\s+/)
|
20
24
|
if node.name == 'svg' && node['style']
|
21
|
-
node['style'] = node['style'].gsub(match_pattern, '')
|
22
|
-
node.attributes['style'].remove if node['style'].empty?
|
25
|
+
node['style'] = node['style'].gsub(match_pattern, ';')
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
29
|
+
@empty_malformed_markup = Loofah::Scrubber.new do |node|
|
30
|
+
node.next.remove while node.name == 'svg' && node.next
|
31
|
+
end
|
32
|
+
|
26
33
|
class << self
|
27
34
|
def call(package)
|
28
35
|
errors = []
|
@@ -30,7 +37,7 @@ module ZendeskAppsSupport
|
|
30
37
|
package.svg_files.each do |svg|
|
31
38
|
markup = Loofah.xml_fragment(svg.read)
|
32
39
|
.scrub!(@strip_declaration)
|
33
|
-
.scrub!(@
|
40
|
+
.scrub!(@strip_spaces_between_css_attrs)
|
34
41
|
.to_xml.strip
|
35
42
|
|
36
43
|
clean_markup = Loofah.xml_fragment(markup)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_apps_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Rosen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-10-
|
14
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|
@@ -273,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
273
|
version: 1.3.6
|
274
274
|
requirements: []
|
275
275
|
rubyforge_project:
|
276
|
-
rubygems_version: 2.6.
|
276
|
+
rubygems_version: 2.6.13
|
277
277
|
signing_key:
|
278
278
|
specification_version: 4
|
279
279
|
summary: Support to help you develop Zendesk Apps.
|