jekyll-heroicons 0.2.1 → 0.3.1
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 +27 -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: 6f9892ee0260b9ee330b410ed33a452cb7ca59619e2eb4545f3c769bcaa28a84
|
4
|
+
data.tar.gz: 10675f3ab7d06b9a2f877a56b7fca7fe605b992f7b88cf072014cafe60611a4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00f81defdf20e8393da9bf39347cd4a9cc083a4b4246201d8e910d0ba85d7565c6a11ba45b7346de9dc1a30f89f6481257661467385ac6b34d36e1e98a11761d
|
7
|
+
data.tar.gz: f280231e9dd755e81c3929f0e2338505dcb0e1c7d0c6ba0b1ed6f606a71eb84b0591ceb4647d8119ab9b437b8402928ca17f06a5ba6456261b6cc9229cbf9e72
|
data/CHANGELOG.md
CHANGED
@@ -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.to_html.
|
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,38 @@ module Jekyll
|
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
+
def config
|
47
|
+
@config ||= begin
|
48
|
+
Jekyll.configuration.dig("heroicons")
|
49
|
+
rescue NoMethodError
|
50
|
+
{}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
46
54
|
def prepare(markup)
|
47
55
|
@symbol = symbol(markup)
|
48
56
|
@options = string_to_hash(markup)
|
49
|
-
@variant =
|
57
|
+
@variant = variant(markup)
|
58
|
+
prepend_default_classes
|
59
|
+
end
|
60
|
+
|
61
|
+
def variant(markup)
|
62
|
+
if (match = markup.split("/")).length > 1
|
50
63
|
match.first
|
51
64
|
elsif @options.key?(:variant)
|
52
65
|
@options[:variant]
|
66
|
+
else
|
67
|
+
config["variant"]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def prepend_default_classes
|
72
|
+
return unless config.dig("default_class", @variant)
|
73
|
+
|
74
|
+
if @options[:class]
|
75
|
+
@options[:class] += " #{config.dig("default_class", @variant)}"
|
76
|
+
else
|
77
|
+
@options[:class] = config.dig("default_class", @variant)
|
53
78
|
end
|
54
79
|
end
|
55
80
|
|
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: 0.
|
4
|
+
version: 0.3.1
|
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
|