jekyll-shorts 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jekyll-shorts.gemspec +1 -1
- data/lib/jekyll-shorts/generator.rb +16 -3
- data/lib/jekyll-shorts/version.rb +1 -1
- 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: 6953f28017721d99160900b5a80a863ad67169fc9340082a05c93e4ea444f5c9
|
4
|
+
data.tar.gz: f7e0bc60d2d07704eadc19900bc9ae086c7e870021202f01222796f5258fbad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7489a031c6a40d7697485957914044110b93e21820ad84f59998a3f81edd785858c307e4e30161ab54329a2b65dae3d29b8131eee76ba29aeff397f7dba9a236
|
7
|
+
data.tar.gz: 3b41b144ac540a9ca2930e6b4cb1242c7511c4835b1a0e1714a94db1f940e60e02b9a6134f7f01a6679d71396bebd9b02ddfcf03e70d343df4ed2371eb72b0c8
|
data/jekyll-shorts.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
29
29
|
s.required_ruby_version = '>= 2.6'
|
30
30
|
s.name = 'jekyll-shorts'
|
31
|
-
s.version = '0.0.
|
31
|
+
s.version = '0.0.4'
|
32
32
|
s.license = 'MIT'
|
33
33
|
s.summary = 'Automatically generates short links for Jekyll website'
|
34
34
|
s.description = [
|
@@ -74,9 +74,22 @@ class JekyllShorts::Generator < Jekyll::Generator
|
|
74
74
|
|
75
75
|
def write(_dest)
|
76
76
|
FileUtils.mkdir_p(File.dirname(path))
|
77
|
-
html = "<html><head><meta
|
78
|
-
|
79
|
-
|
77
|
+
html = "<html><head><meta charset='utf-8'/>\
|
78
|
+
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\
|
79
|
+
<meta http-equiv='refresh' content='#{@long}'/></head></html>"
|
80
|
+
if File.exist?(path)
|
81
|
+
before = File.read(path)
|
82
|
+
if before != html
|
83
|
+
raise "It's impossible to generate a short link at #{path.inspect}, \
|
84
|
+
because the file already exists and the content \
|
85
|
+
of the it differs from what we are going to write into it now (#{long}). This most \
|
86
|
+
probably means that previously generated short link will point to a different location \
|
87
|
+
than before. Try to run 'jekyll clean', it will help, if you know what you are doing."
|
88
|
+
end
|
89
|
+
else
|
90
|
+
File.write(path, html)
|
91
|
+
Jekyll.logger.debug("HTML #{path.inspect} -> #{@long.inspect}")
|
92
|
+
end
|
80
93
|
true
|
81
94
|
end
|
82
95
|
end
|