jekyll-js-converter 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-js-converter/version.rb +1 -1
- data/lib/jekyll/converters/js.rb +11 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dbb1d9c51749616f197d23c0210a5f9cca4e46235a9ef8f0d64528903090d08
|
4
|
+
data.tar.gz: 9d79b25157ea3579e0338fe6d9f74149ae5be2769b3d0a15f4c2cfc1e379205e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4d31d5caff7f8eb48e6b1653ee6ffbcabaf853f6202355fd51370cdf53e0c634b5cc75972782b3348f10986c57483555ef662da6e0317491419d2febd171389
|
7
|
+
data.tar.gz: 38a3249861d2afad8e7e0284812c647fc4b67f59e79c6d37d2c7b8b89ef6e9d2d4c8b2615d4a48f01bf6cb57960d27a7190578e7c57b952c88a917452c70ccd7
|
data/lib/jekyll/converters/js.rb
CHANGED
@@ -74,7 +74,7 @@ module Jekyll
|
|
74
74
|
private
|
75
75
|
|
76
76
|
def insert_imports(content)
|
77
|
-
content.enum_for(:scan, /^\W*=\s*(\w+)\W+([\w
|
77
|
+
content.enum_for(:scan, /^\W*=\s*(\w+)\W+([\w\/\\\-\.:]+)\W*$/).map {
|
78
78
|
{ directive: Regexp.last_match[1],
|
79
79
|
path: Regexp.last_match[2],
|
80
80
|
insert_at: Regexp.last_match.end(0) }
|
@@ -86,17 +86,21 @@ module Jekyll
|
|
86
86
|
import_content = load_paths.reduce([]) { |files, load_path|
|
87
87
|
glob = case match[:directive]
|
88
88
|
when 'import'
|
89
|
-
match[:path]
|
90
|
-
|
89
|
+
if (match[:path] =~ URI::regexp).nil?
|
90
|
+
match[:path] += '.js' unless match[:path].end_with?('.js')
|
91
|
+
Dir.glob(File.join(load_path, '**', match[:path]))
|
92
|
+
else
|
93
|
+
[match[:path]]
|
94
|
+
end
|
91
95
|
when 'import_directory'
|
92
|
-
File.join(load_path, '**', match[:path], '*.js')
|
96
|
+
Dir.glob(File.join(load_path, '**', match[:path], '*.js'))
|
93
97
|
when 'import_tree'
|
94
|
-
File.join(load_path, '**', match[:path], '**', '*.js')
|
98
|
+
Dir.glob(File.join(load_path, '**', match[:path], '**', '*.js'))
|
95
99
|
end
|
96
100
|
|
97
|
-
files +
|
101
|
+
files + glob
|
98
102
|
}.uniq.reduce('') { |import_content, file|
|
99
|
-
import_content += File.read(file)
|
103
|
+
import_content += (file =~ URI::regexp).nil? ? File.read(file) : Net::HTTP.get(URI(file))
|
100
104
|
}
|
101
105
|
|
102
106
|
content.insert(match[:insert_at], "\n#{insert_imports(import_content)}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-js-converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Susco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.0.8
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: A JavaScript converter for Jekyll.
|