jekyll-heroicons 0.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/jekyll-heroicons/icon.rb +1 -11
- data/lib/jekyll-heroicons/version.rb +1 -1
- data/lib/jekyll-heroicons.rb +25 -2
- 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: 3685591a1423c6c548b5e6a3381c8559a141c87c11e0e5c8db082bb5ba9df456
|
4
|
+
data.tar.gz: 4f4e3948c4d4b07d5bdd3f9c1974b7d50ec9c79e59749b5953df26f7069829e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa85bec0a59401be1a498665dc13cbcd77935dcdedaa7e0cecefed90d3d679247e408e7694feb08a12b1c8839d82e2df72a55f7763fab379809d63e7901a5292
|
7
|
+
data.tar.gz: 7b616f08a1d3e57adb75dafcfb17b8aec4420cae5ac8be676e0c48e8b88ffdb00d296b5946d4332f1d58ad949fb477cbe45173f8090841bc146ae7828492438c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Jekyll-Heroicons
|
2
2
|
|
3
|
+
## 0.3.0
|
4
|
+
- We can define in _config.yml default variant and default classes for each variant.
|
5
|
+
## 0.2.1
|
6
|
+
- Remove new line character from icon raw code.
|
3
7
|
## 0.2.0
|
4
8
|
- Introduce Icon class to deal with different parameters that could be passed to vsg code.
|
5
9
|
## 0.1.1
|
@@ -13,25 +13,15 @@ module Jekyll
|
|
13
13
|
doc = Nokogiri::HTML::DocumentFragment.parse(file)
|
14
14
|
svg = doc.at_css "svg"
|
15
15
|
|
16
|
-
prepend_default_classes
|
17
|
-
|
18
16
|
@options.each do |key, value|
|
19
17
|
svg[key.to_s] = value
|
20
18
|
end
|
21
19
|
|
22
|
-
doc
|
20
|
+
doc.to_html(save_with: 0).delete("\n")
|
23
21
|
end
|
24
22
|
|
25
23
|
private
|
26
24
|
|
27
|
-
def prepend_default_classes
|
28
|
-
if @options[:class]
|
29
|
-
@options[:class] += " size-6"
|
30
|
-
else
|
31
|
-
@options[:class] = "size-6"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
25
|
def file
|
36
26
|
@file ||= File.read(file_path).force_encoding("UTF-8")
|
37
27
|
end
|
data/lib/jekyll-heroicons.rb
CHANGED
@@ -17,7 +17,7 @@ module Jekyll
|
|
17
17
|
SYNTAX = /\A(#{Liquid::VariableSignature}+)/
|
18
18
|
|
19
19
|
# For interpolation, look for liquid variables
|
20
|
-
VARIABLE = /\{\{\s*(
|
20
|
+
VARIABLE = /\{\{\s*(\w+\.?\w*)\s*\}\}/i
|
21
21
|
|
22
22
|
# Copied from Liquid::TagAttributes to allow dashes in tag names:
|
23
23
|
#
|
@@ -43,13 +43,36 @@ module Jekyll
|
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
+
def config
|
47
|
+
return {} unless defined?(context) && context.registers[:site]
|
48
|
+
|
49
|
+
context.registers[:site].config["heroicons"]
|
50
|
+
end
|
51
|
+
|
46
52
|
def prepare(markup)
|
47
53
|
@symbol = symbol(markup)
|
48
54
|
@options = string_to_hash(markup)
|
49
|
-
@variant =
|
55
|
+
@variant = variant(markup)
|
56
|
+
prepend_default_classes
|
57
|
+
end
|
58
|
+
|
59
|
+
def variant(markup)
|
60
|
+
if (match = markup.split("/")).length > 1
|
50
61
|
match.first
|
51
62
|
elsif @options.key?(:variant)
|
52
63
|
@options[:variant]
|
64
|
+
else
|
65
|
+
config["variant"]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def prepend_default_classes
|
70
|
+
return unless config.dig("default_class", @variant)
|
71
|
+
|
72
|
+
if @options[:class]
|
73
|
+
@options[:class] += " #{config.dig("default_class", @variant)}"
|
74
|
+
else
|
75
|
+
@options[:class] = config.dig("default_class", @variant)
|
53
76
|
end
|
54
77
|
end
|
55
78
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-heroicons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav (Stas) Katkov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|