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 +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +8 -8
- data/lib/jekyll-react-component/version.rb +1 -1
- data/lib/jekyll-react-component.rb +6 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8830c92051907a1e8be3eca843efd1dd237729d25518a861b421cde4393ad864
|
4
|
+
data.tar.gz: 538673e10dfaeff8042dbf0db2f9efa6699ba4f5666a7c4fb453b1880389ef77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 828386b4f5abe12afec6280222baa9c5f5c5264d506d7b3eb8027eff43b6eb13a58fb3a6f37ed164f9cce11f61365432dfc7a284dcb85220efcd404ac365c478
|
7
|
+
data.tar.gz: ca2791f3de4ac77fd914e5b3080a298c3ff772f0fefe84de5f5744c785874cb4d8d9ca2ac877c082f38d4ab1471ac545a1721565750f707829d7acb948b4b9c4
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-react-component (0.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.
|
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.
|
24
|
+
ffi (1.15.5)
|
25
25
|
forwardable-extended (2.6.0)
|
26
|
-
i18n (1.
|
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.
|
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.
|
52
|
-
nokogiri (1.
|
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.
|
93
|
+
zeitwerk (2.5.4)
|
94
94
|
|
95
95
|
PLATFORMS
|
96
96
|
x86_64-linux
|
@@ -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
|
-
|
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?(
|
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
|
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
|
-
|
35
|
+
|
36
|
+
REACT_COMPONENT_PAGES_ID.clear
|
38
37
|
page.output = doc.to_html
|
39
38
|
end
|
40
39
|
end
|