bridgetown-svg-inliner 1.1.0 → 2.1.0
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/.github/workflows/tests.yml +1 -1
- data/.rubocop.yml +25 -6
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/README.md +48 -8
- data/Rakefile +10 -8
- data/bridgetown-svg-inliner.gemspec +2 -2
- data/lib/bridgetown-svg-inliner/liquid_attributes.rb +2 -2
- data/lib/bridgetown-svg-inliner/version.rb +1 -1
- data/lib/bridgetown-svg-inliner.rb +3 -1
- metadata +8 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 518bc71334a9da546a629b0ff463a1da102bdba4656ddb8c62a4d9762bbd425c
|
4
|
+
data.tar.gz: 4a4bec499b3448df99192ca41e8e1d4b7c6be7fe47f54b3a1c2231b087cd0f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 592a9d4ea664ea4f71da8e688989e3c788dc7f0dcecae0d43f0e943157c2003b4ce72a9bc5e54f4620b878e923782ef88cd64d3b92e2b9394da80c607bd61aea
|
7
|
+
data.tar.gz: 18b37c9974f2593027d4f0f7050281e99b147f8080e8ea9d0115084314e65fef134e96659022bd5ffad2b50f1ca9ead27fdf11e00f62689f22d437e3244485d1
|
data/.github/workflows/tests.yml
CHANGED
@@ -14,7 +14,7 @@ jobs:
|
|
14
14
|
strategy:
|
15
15
|
matrix:
|
16
16
|
ruby_version: [2.7.7, 3.0.5, 3.1.3, 3.2.0]
|
17
|
-
bridgetown_version: [1.
|
17
|
+
bridgetown_version: [1.2.0]
|
18
18
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
19
19
|
# Has to be top level to cache properly
|
20
20
|
env:
|
data/.rubocop.yml
CHANGED
@@ -4,27 +4,46 @@ inherit_gem:
|
|
4
4
|
rubocop-bridgetown: .rubocop.yml
|
5
5
|
|
6
6
|
AllCops:
|
7
|
-
TargetRubyVersion: 2.
|
8
|
-
Include:
|
9
|
-
- lib/**/*.rb
|
10
|
-
- test/**/*.rb
|
7
|
+
TargetRubyVersion: 2.7
|
11
8
|
|
12
9
|
Exclude:
|
13
10
|
- .gitignore
|
14
11
|
- .rubocop.yml
|
12
|
+
- "*.gemspec"
|
15
13
|
|
16
14
|
- Gemfile.lock
|
17
15
|
- CHANGELOG.md
|
18
|
-
- LICENSE.
|
16
|
+
- LICENSE.txt
|
19
17
|
- README.md
|
18
|
+
- Rakefile
|
19
|
+
- bridgetown.automation.rb
|
20
20
|
|
21
21
|
- script/**/*
|
22
|
+
- test/fixtures/**/*
|
22
23
|
- vendor/**/*
|
23
24
|
|
25
|
+
Layout/LineLength:
|
26
|
+
Max: 140
|
27
|
+
|
28
|
+
Metrics/BlockLength:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Bundler/OrderedGems:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/IfUnlessModifier:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Layout/IndentationConsistency:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Layout/IndentationWidth:
|
41
|
+
Enabled: false
|
42
|
+
|
24
43
|
Style/MultilineIfModifier:
|
25
44
|
Enabled: false
|
26
45
|
|
27
|
-
Style/
|
46
|
+
Style/MapToHash:
|
28
47
|
Enabled: false
|
29
48
|
|
30
49
|
Lint/AmbiguousBlockAssociation:
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,17 @@ A Bridgetown plugin that provides a liquid tag and ERB helper to inline SVG file
|
|
10
10
|
Run this command to add this plugin to your site's Gemfile:
|
11
11
|
|
12
12
|
```shell
|
13
|
-
$ bundle add "bridgetown-svg-inliner"
|
13
|
+
$ bundle add "bridgetown-svg-inliner"
|
14
|
+
```
|
15
|
+
|
16
|
+
Initialize it in your `config/initializers.rb` file.
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
Bridgetown.configure do |config|
|
20
|
+
# ...
|
21
|
+
|
22
|
+
init :"bridgetown-svg-inliner"
|
23
|
+
end
|
14
24
|
```
|
15
25
|
|
16
26
|
## Usage
|
@@ -27,6 +37,11 @@ This plugin provides an `svg` tag in Liquid and an `svg` helper in ERB or other
|
|
27
37
|
<%= svg "/assets/icons/thumbs-up.svg" %>
|
28
38
|
```
|
29
39
|
|
40
|
+
```serb
|
41
|
+
<!-- Serbea -->
|
42
|
+
{%= svg "/assets/icons/thumbs-up.svg" %}
|
43
|
+
```
|
44
|
+
|
30
45
|
### Attributes
|
31
46
|
|
32
47
|
You can pass in attributes that you'd like to include on the `svg` tag in the HTML output.
|
@@ -41,14 +56,19 @@ You can pass in attributes that you'd like to include on the `svg` tag in the HT
|
|
41
56
|
<%= svg "/assets/icons/thumbs-up.svg", class: "icon" %>
|
42
57
|
```
|
43
58
|
|
59
|
+
```serb
|
60
|
+
<!-- Serbea -->
|
61
|
+
{%= svg "/assets/icons/thumbs-up.svg", class: "icon" %}
|
62
|
+
```
|
63
|
+
|
44
64
|
```html
|
45
65
|
<!-- Output -->
|
46
|
-
<svg class="icon">
|
47
|
-
...
|
48
|
-
</svg>
|
66
|
+
<svg class="icon">...</svg>
|
49
67
|
```
|
50
68
|
|
51
|
-
###
|
69
|
+
### Variables
|
70
|
+
|
71
|
+
#### Liquid variables
|
52
72
|
|
53
73
|
You can use Liquid variables by enclosing them in double braces (`{{ }}`)
|
54
74
|
|
@@ -59,10 +79,30 @@ You can use Liquid variables by enclosing them in double braces (`{{ }}`)
|
|
59
79
|
{% svg "/assets/icons/{{ svg_file }}.svg", class: "{{ svg_class_list }}" %}
|
60
80
|
```
|
61
81
|
|
82
|
+
#### ERB variables
|
83
|
+
|
84
|
+
You can use ERB variables.
|
85
|
+
|
86
|
+
```erb
|
87
|
+
<% svg_file = "thumbs-up.svg" %>
|
88
|
+
<% svg_class_list = "icon icon--small" %>
|
89
|
+
<%= svg "/assets/icons/" + svg_file, class: "svg_class_list" %>
|
90
|
+
```
|
91
|
+
|
92
|
+
#### Serbea variables
|
93
|
+
|
94
|
+
You can use Serbea variables.
|
95
|
+
|
96
|
+
```serb
|
97
|
+
{% svg_file = "thumbs-up.svg" %}
|
98
|
+
{% svg_class_list = "icon icon--small" %}
|
99
|
+
{%= svg "/assets/icons/" + svg_file, class: "svg_class_list" %}
|
100
|
+
```
|
101
|
+
|
62
102
|
## Testing
|
63
103
|
|
64
|
-
|
65
|
-
|
104
|
+
- Run `bundle exec rake test` to run the test suite
|
105
|
+
- Or run `script/cibuild` to validate with Rubocop and Minitest together.
|
66
106
|
|
67
107
|
## Contributing
|
68
108
|
|
@@ -77,4 +117,4 @@ You can use Liquid variables by enclosing them in double braces (`{{ }}`)
|
|
77
117
|
|
78
118
|
Bridgetown SVG Inliner is released under the [MIT License](https://opensource.org/licenses/MIT).
|
79
119
|
|
80
|
-
Copyright ©
|
120
|
+
Copyright © 2023 [Ayush Newatia](https://twitter.com/ayushn21)
|
data/Rakefile
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
8
|
-
t.warning = false
|
9
|
-
end
|
5
|
+
task spec: :test
|
6
|
+
require "rake/testtask"
|
10
7
|
|
11
|
-
|
8
|
+
Rake::TestTask.new(:test) do |test|
|
9
|
+
test.libs << "lib" << "test"
|
10
|
+
test.pattern = "test/**/test_*.rb"
|
11
|
+
test.verbose = true
|
12
|
+
test.warning = false
|
13
|
+
end
|
@@ -16,9 +16,9 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
spec.metadata = {}
|
18
18
|
|
19
|
-
spec.required_ruby_version = ">=
|
19
|
+
spec.required_ruby_version = ">= 3.0.0"
|
20
20
|
|
21
|
-
spec.add_dependency "bridgetown", ">= 1.0", "<
|
21
|
+
spec.add_dependency "bridgetown", ">= 1.2.0", "< 3.0"
|
22
22
|
spec.add_dependency "nokogiri"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler"
|
@@ -8,7 +8,7 @@ module BridgetownSvgInliner
|
|
8
8
|
path, args = attributes.split(",", 2)
|
9
9
|
|
10
10
|
@path = unescape_string(path)
|
11
|
-
@args = args.scan(%r{([a-zA-Z0-9_
|
11
|
+
@args = args.scan(%r{([a-zA-Z0-9_-]+)\s*:\s*(#{Liquid::QuotedFragment})}o).map do |arg|
|
12
12
|
[arg[0], unescape_string(arg[1])]
|
13
13
|
end.to_h if args.present?
|
14
14
|
end
|
@@ -17,7 +17,7 @@ module BridgetownSvgInliner
|
|
17
17
|
|
18
18
|
def unescape_string(string)
|
19
19
|
string.undump
|
20
|
-
rescue
|
20
|
+
rescue # rubocop:disable Style/RescueStandardError
|
21
21
|
string
|
22
22
|
end
|
23
23
|
end
|
@@ -8,4 +8,6 @@ module BridgetownSvgInliner
|
|
8
8
|
autoload :LiquidAttributes, "bridgetown-svg-inliner/liquid_attributes"
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
Bridgetown.initializer :"bridgetown-svg-inliner" do |config|
|
12
|
+
config.builder BridgetownSvgInliner::Builder
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-svg-inliner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ayush Newatia
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: bridgetown
|
@@ -16,20 +15,20 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
18
|
+
version: 1.2.0
|
20
19
|
- - "<"
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
21
|
+
version: '3.0'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
28
|
+
version: 1.2.0
|
30
29
|
- - "<"
|
31
30
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
31
|
+
version: '3.0'
|
33
32
|
- !ruby/object:Gem::Dependency
|
34
33
|
name: nokogiri
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +85,6 @@ dependencies:
|
|
86
85
|
- - ">="
|
87
86
|
- !ruby/object:Gem::Version
|
88
87
|
version: '0'
|
89
|
-
description:
|
90
88
|
email: ayush@hey.com
|
91
89
|
executables: []
|
92
90
|
extensions: []
|
@@ -109,7 +107,6 @@ homepage: https://github.com/ayushn21/bridgetown-svg-inliner
|
|
109
107
|
licenses:
|
110
108
|
- MIT
|
111
109
|
metadata: {}
|
112
|
-
post_install_message:
|
113
110
|
rdoc_options: []
|
114
111
|
require_paths:
|
115
112
|
- lib
|
@@ -117,15 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
114
|
requirements:
|
118
115
|
- - ">="
|
119
116
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
117
|
+
version: 3.0.0
|
121
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
119
|
requirements:
|
123
120
|
- - ">="
|
124
121
|
- !ruby/object:Gem::Version
|
125
122
|
version: '0'
|
126
123
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
128
|
-
signing_key:
|
124
|
+
rubygems_version: 3.6.2
|
129
125
|
specification_version: 4
|
130
126
|
summary: Liquid and ERB helper for Bridgetown to inline SVG files within HTML
|
131
127
|
test_files: []
|