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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 112fbd4869748edda881eba9c9ef2ee54455adc9bd02f9459f2b6f6283561242
4
- data.tar.gz: fd5b1f750f6a421d0ec7666a653c572d468cd7e3d062bc0dbe635641d8f40f87
3
+ metadata.gz: 6f9892ee0260b9ee330b410ed33a452cb7ca59619e2eb4545f3c769bcaa28a84
4
+ data.tar.gz: 10675f3ab7d06b9a2f877a56b7fca7fe605b992f7b88cf072014cafe60611a4a
5
5
  SHA512:
6
- metadata.gz: fb3f32efc24439124b355dd25a95265c7253045864de3a4bf513b63d4c1cc1451bfb4c17602cdf1b192d260b6eebcc05e187128d8a2cef738e94f91c07bfefc2
7
- data.tar.gz: 6da0122ce4bac2056602a170e1a02d522e0d12f744fb7f76bc10b4b7832e2f391415b1658d5dce1e8a0879ccf895ab6395012126c48e097e478d01f0dd196120
6
+ metadata.gz: 00f81defdf20e8393da9bf39347cd4a9cc083a4b4246201d8e910d0ba85d7565c6a11ba45b7346de9dc1a30f89f6481257661467385ac6b34d36e1e98a11761d
7
+ data.tar.gz: f280231e9dd755e81c3929f0e2338505dcb0e1c7d0c6ba0b1ed6f606a71eb84b0591ceb4647d8119ab9b437b8402928ca17f06a5ba6456261b6cc9229cbf9e72
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Jekyll-Heroicons
2
2
 
3
+ ## 0.3.1
4
+ - Fix Site.configuration retrieval.
5
+ ## 0.3.0
6
+ - We can define in _config.yml default variant and default classes for each variant.
3
7
  ## 0.2.1
4
8
  - Remove new line character from icon raw code.
5
9
  ## 0.2.0
@@ -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.strip
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
@@ -5,6 +5,6 @@ module Liquid; class Tag; end; end
5
5
 
6
6
  module Jekyll
7
7
  class Heroicons < Liquid::Tag
8
- VERSION = "0.2.1"
8
+ VERSION = "0.3.1"
9
9
  end
10
10
  end
@@ -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*([\w]+\.?[\w]*)\s*\}\}/i
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 = if (match = markup.split("/")).length > 1
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.2.1
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-22 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll