jekyll-react-component 0.1.1 → 0.1.2

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: 30257ded0f3d4b67e399cd23f0c8b7e06a87ee1431a52406282a81059be60851
4
- data.tar.gz: 890a4274afc9f3c6f4fd32f7d72ae384a622a31e8d397907d60ea6217f401f01
3
+ metadata.gz: 8830c92051907a1e8be3eca843efd1dd237729d25518a861b421cde4393ad864
4
+ data.tar.gz: 538673e10dfaeff8042dbf0db2f9efa6699ba4f5666a7c4fb453b1880389ef77
5
5
  SHA512:
6
- metadata.gz: f4598f2a84bf424cd52d21a7f7cd1dd10463ba96ad35a96aacd9a82dbc9d3159ff978d2ea8324a5ac41944841456d6b8f3fc60bc1f9fd83dd648ee9502f007c1
7
- data.tar.gz: 787a01b9ab49259a35d8c3897a345197727699a568ef81b6f05422c892a925debf71a66c314ca649df7c6be005e5f0a09c64b68c620c3e08f3eaa541d0ed0ddc
6
+ metadata.gz: 828386b4f5abe12afec6280222baa9c5f5c5264d506d7b3eb8027eff43b6eb13a58fb3a6f37ed164f9cce11f61365432dfc7a284dcb85220efcd404ac365c478
7
+ data.tar.gz: ca2791f3de4ac77fd914e5b3080a298c3ff772f0fefe84de5f5744c785874cb4d8d9ca2ac877c082f38d4ab1471ac545a1721565750f707829d7acb948b4b9c4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.2] - 2022-02-05
4
+ - Use constant instead of global
5
+
3
6
  ## [0.1.1] - 2022-02-05
4
7
  - Add import map only if a page defines react_component
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-react-component (0.1.1)
4
+ jekyll-react-component (0.1.2)
5
5
  activesupport (~> 6.1, >= 6.1.4.1)
6
6
  jekyll
7
7
  json-schema (~> 2.8, >= 2.8.1)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.4.1)
13
+ activesupport (6.1.4.4)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
@@ -21,9 +21,9 @@ GEM
21
21
  ast (2.4.2)
22
22
  colorator (1.1.0)
23
23
  concurrent-ruby (1.1.9)
24
- ffi (1.15.4)
24
+ ffi (1.15.5)
25
25
  forwardable-extended (2.6.0)
26
- i18n (1.8.11)
26
+ i18n (1.9.1)
27
27
  concurrent-ruby (~> 1.0)
28
28
  jekyll (3.6.3)
29
29
  addressable (~> 2.4)
@@ -44,12 +44,12 @@ GEM
44
44
  addressable (>= 2.4)
45
45
  kramdown (1.17.0)
46
46
  liquid (4.0.3)
47
- listen (3.7.0)
47
+ listen (3.7.1)
48
48
  rb-fsevent (~> 0.10, >= 0.10.3)
49
49
  rb-inotify (~> 0.9, >= 0.9.10)
50
50
  mercenary (0.3.6)
51
- minitest (5.14.4)
52
- nokogiri (1.12.5-x86_64-linux)
51
+ minitest (5.15.0)
52
+ nokogiri (1.13.1-x86_64-linux)
53
53
  racc (~> 1.4)
54
54
  parallel (1.20.1)
55
55
  parser (3.0.2.0)
@@ -90,7 +90,7 @@ GEM
90
90
  tzinfo (2.0.4)
91
91
  concurrent-ruby (~> 1.0)
92
92
  unicode-display_width (2.0.0)
93
- zeitwerk (2.5.1)
93
+ zeitwerk (2.5.4)
94
94
 
95
95
  PLATFORMS
96
96
  x86_64-linux
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module ReactComponent
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
@@ -5,16 +5,15 @@ require 'nokogiri'
5
5
  require_relative 'jekyll-react-component/react_component'
6
6
  require_relative 'jekyll-react-component/version'
7
7
 
8
- $react_component_pages_id = []
8
+ REACT_COMPONENT_PAGES_ID = [] # rubocop:disable Style/MutableConstant
9
+ REACT_COMPONENT_REGEX = /\{% react_component .+ %\}(.|\n)*\{% endreact_component %\}/.freeze
9
10
 
10
11
  Jekyll::Hooks.register [:pages, :posts], :pre_render do |page|
11
- if page.content.match?(/\{% react_component .+ %\}(.|\n)*\{% endreact_component %\}/)
12
- $react_component_pages_id << page.object_id
13
- end
12
+ REACT_COMPONENT_PAGES_ID << page.object_id if page.content.match?(REACT_COMPONENT_REGEX)
14
13
  end
15
14
 
16
15
  Jekyll::Hooks.register [:pages, :posts], :post_render do |page|
17
- if $react_component_pages_id.include?(page.object_id)
16
+ if REACT_COMPONENT_PAGES_ID.include?(page.object_id)
18
17
  html = page.output
19
18
  doc = Nokogiri::HTML(html)
20
19
  head = doc.at_css('head')
@@ -33,8 +32,8 @@ Jekyll::Hooks.register [:pages, :posts], :post_render do |page|
33
32
  </script>
34
33
  CODE
35
34
  end
36
-
37
- $react_component_pages_id.clear
35
+
36
+ REACT_COMPONENT_PAGES_ID.clear
38
37
  page.output = doc.to_html
39
38
  end
40
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-react-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Jakubiak