jekyll-octicons 1.1.0 → 2.0.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODg3ZjVlMjI0YWFjZDBjZGY2NTE4YTE0MjczOTVlOWU2YTU3ODkyMA==
4
+ YWE3NGQzMjMzZmZkOTI4MTdkYzk1ZjMxMTljNGRkZDE1OTgzZTdiNw==
5
5
  data.tar.gz: !binary |-
6
- ZDhjNDI1OTMwYTU5YThmNjgzMWY0MjY5NWFlZWYwZjM5Zjc0ZDBkNA==
6
+ ZDhhMTVkM2JhNzdkNThhODYwYmJlZDNlZTA5NjYxMzM5NDNhYmRjYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGE2YmYzYWZmNjliMzExMTkzYTYzYWFkZmM4NTFkYzY3MzYxNjEyMWQxZmJh
10
- Nzc4Njc4MTRmMGExNjgzYjU3ODM0OGQxN2Y5YjZhODMxYzA3MDA0Y2E2NzYx
11
- NTBlMjQyMDJiZDJkYzA0NmVkNTMzYzQxYzkzODI2YTRiMzI0ZDc=
9
+ MTU1ODIyMTNhMjFlY2VjZGJmMmI4NDFiYzczODFkNTZiNTcyMTE4NjNmODc0
10
+ OWFjZTFmNzM1MTE1ZGM0ZTllNGYyYjQwODgwNDI1YzA3ZTE1ZGEwNGJjMmI4
11
+ MjBhZGU1YmUwNzhmNzY0Y2IzNjViY2Q0NGU1NTllNTk5ZTA3OWI=
12
12
  data.tar.gz: !binary |-
13
- NDA2NzEyMGQxY2I0MjZiZDNmNjg5YzZkNjIxMmVlNDRhZWNmY2E3NGQwNDcw
14
- ZGQ3ZDQ4ZDcyOTc1ZGIzOWRkYTYyMjk1M2I1ZDI4ZmFiNmQ4NDg5NDc1ZGQx
15
- ZTk1NzQ3ODZkNzJjODVlOGZjOWQ1ZDE3NWEzZDk2MDQ1MDIwNTg=
13
+ MzliYWZmOWU3NDg3NmM5Y2JkNmFkNmE3MGI3ODZjNzI2ZWRjNWJjNWNkYjNi
14
+ YzFmOTc2YmQ2ZmQ4ZTVjNGNkMDBkMTc3OGRiNDg1OWYwNDE5OGNjN2Q1ZTFh
15
+ OGI2NTY3MWY4NWZmODAwODM1ZGVlODhjOWE0N2Q0YzA1ZjY2NzE=
data/README.md CHANGED
@@ -25,7 +25,7 @@ This jekyll liquid tag, is a plugin that will let you easily include svg [octico
25
25
  3. Use this tag in your jekyll templates
26
26
 
27
27
  ```
28
- {% octicon alert size:large class:"right left" aria-label:hi %}
28
+ {% octicon alert height:32 class:"right left" aria-label:hi %}
29
29
  ```
30
30
 
31
31
  The minimum CSS you'll need in your jekyll site is in the [octicons][octicons] repository. You can also npm install that package and include `build/octicons.css` in your styles.
@@ -22,26 +22,42 @@ module Jekyll
22
22
  def initialize(tag_name, markup, options)
23
23
  super
24
24
  @markup = markup
25
- @options = string_to_hash(markup)
25
+ # If there's interpoaltion going on, we need to do this in render
26
+ prepare(markup) unless match = markup.match(Variable)
26
27
  end
27
28
 
28
29
  def render(context)
29
- @markup.scan Variable do |variable|
30
- @options = string_to_hash(@markup.gsub(Variable, lookup_variable(context, variable.first)))
31
- end
32
- return nil if @options[:symbol].nil?
33
- ::Octicons::Octicon.new(@options).to_svg
30
+ prepare(interpolate(@markup, context)) if match = @markup.match(Variable)
31
+
32
+ return nil if @symbol.nil?
33
+ ::Octicons::Octicon.new(@symbol, @options).to_svg
34
34
  end
35
35
 
36
36
  private
37
37
 
38
+ def interpolate(markup, context)
39
+ markup.scan Variable do |variable|
40
+ markup = markup.gsub(Variable, lookup_variable(context, variable.first))
41
+ end
42
+ markup
43
+ end
44
+
45
+ def prepare(markup)
46
+ @symbol = symbol(markup)
47
+ @options = string_to_hash(markup)
48
+ end
49
+
50
+ def symbol(markup)
51
+ if match = markup.match(Syntax)
52
+ match[1]
53
+ end
54
+ end
55
+
38
56
  # Create a ruby hash from a string passed by the jekyll tag
39
57
  def string_to_hash(markup)
40
58
  options = {}
41
59
 
42
60
  if match = markup.match(Syntax)
43
- options[:symbol] = match[1]
44
-
45
61
  markup.scan(TagAttributes) do |key, value|
46
62
  options[key.to_sym] = value.gsub(/\A"|"\z/, '')
47
63
  end
@@ -3,6 +3,6 @@ module Liquid; class Tag; end; end
3
3
 
4
4
  module Jekyll
5
5
  class Octicons < Liquid::Tag
6
- VERSION = '1.1.0'.freeze
6
+ VERSION = '2.0.0'.freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-octicons
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-15 00:00:00.000000000 Z
11
+ date: 2016-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '2.0'
41
41
  description: A jekyll liquid plugin that makes including svg Octicons simple.
42
42
  email:
43
43
  - support@github.com