jekyll-shorts 0.0.1 → 0.0.2
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 +4 -4
- data/Gemfile +1 -1
- data/README.md +5 -4
- data/features/cli.feature +3 -3
- data/jekyll-shorts.gemspec +1 -1
- data/lib/jekyll-shorts/generator.rb +7 -6
- 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: 4e3da7798de2799f22b31f8b3577fa64b463f0752c69ee1245e50c3504b751b1
|
4
|
+
data.tar.gz: 05d91a265d00d1e224e24f56545f791d49c9e399ca44a6b6975c277f16d06daf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7058a47b552c15da5bbdd67a3181bf1ead73e38155e02a666f4142a1b77ee0a290703f4e1973c777e2b8735a4c1042de15d9fe3dc191a2ce5d110f14707ebcd
|
7
|
+
data.tar.gz: a7d4c9fef312a2fdef994a030c92bcf3afc0d358f1c3a7a8afa50962807bae92e20917c3c4ff61f8c6431b2a44ea34eba47d44e129654ec1b08fa41d6dfa6faf
|
data/Gemfile
CHANGED
@@ -26,7 +26,7 @@ source 'https://rubygems.org'
|
|
26
26
|
gemspec
|
27
27
|
|
28
28
|
gem 'cucumber', '9.1.0', require: false
|
29
|
-
gem 'minitest', '5.
|
29
|
+
gem 'minitest', '5.22.1', require: false
|
30
30
|
gem 'rake', '13.1.0', require: false
|
31
31
|
gem 'rubocop', '1.59.0', require: false
|
32
32
|
gem 'rubocop-rspec', '2.26.1', require: false
|
data/README.md
CHANGED
@@ -25,10 +25,11 @@ shorts:
|
|
25
25
|
Here, every page in the site will get a sibling with the name
|
26
26
|
`:year:month:day.html`, which will redirect to the page itself. You can use:
|
27
27
|
|
28
|
-
* `:
|
29
|
-
* `:
|
30
|
-
* `:
|
31
|
-
* `:
|
28
|
+
* `:Y` - the full year of the post, like `2022` or `1976`
|
29
|
+
* `:y` - the short form of the year of the post, like `23` or `76`
|
30
|
+
* `:m` - the month of the post, like `01` or `12`
|
31
|
+
* `:d` - the day of the post, like `07` or `29`
|
32
|
+
* `:pos` - the unique position of the post in the entire list of them, like `42` or `256`
|
32
33
|
|
33
34
|
Be careful with the `:position`, since it may change when you add a new post
|
34
35
|
somewhere in the middle of existing flow of posts.
|
data/features/cli.feature
CHANGED
@@ -8,13 +8,13 @@ Feature: Simple site building
|
|
8
8
|
plugins:
|
9
9
|
- jekyll-shorts
|
10
10
|
shorts:
|
11
|
-
permalink: :
|
11
|
+
permalink: :y:m:d.html
|
12
12
|
"""
|
13
13
|
And I have a "_layouts/default.html" file with content:
|
14
14
|
"""
|
15
15
|
{{ content }}
|
16
16
|
"""
|
17
|
-
And I have a "_posts/2023-
|
17
|
+
And I have a "_posts/2023-07-29-hello.md" file with content:
|
18
18
|
"""
|
19
19
|
---
|
20
20
|
title: Hello, world!
|
@@ -24,4 +24,4 @@ Feature: Simple site building
|
|
24
24
|
"""
|
25
25
|
Then I build Jekyll site
|
26
26
|
And Exit code is zero
|
27
|
-
And File "_site/
|
27
|
+
And File "_site/230729.html" exists
|
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.2'
|
32
32
|
s.license = 'MIT'
|
33
33
|
s.summary = 'Automatically generates short links for Jekyll website'
|
34
34
|
s.description = [
|
@@ -50,10 +50,11 @@ class JekyllShorts::Generator < Jekyll::Generator
|
|
50
50
|
short = Jekyll::URL.new(
|
51
51
|
template: permalink,
|
52
52
|
placeholders: {
|
53
|
-
'
|
54
|
-
'
|
55
|
-
'
|
56
|
-
'
|
53
|
+
'Y' => doc.date.year.to_s,
|
54
|
+
'y' => doc.date.year.to_s[2..],
|
55
|
+
'm' => doc.date.month.to_s.rjust(2, '0'),
|
56
|
+
'd' => doc.date.day.to_s.rjust(2, '0'),
|
57
|
+
'pos' => pos.to_s
|
57
58
|
}
|
58
59
|
).to_s
|
59
60
|
site.static_files << ShortFile.new(site, short, long)
|
@@ -73,9 +74,9 @@ class JekyllShorts::Generator < Jekyll::Generator
|
|
73
74
|
|
74
75
|
def write(_dest)
|
75
76
|
FileUtils.mkdir_p(File.dirname(path))
|
76
|
-
html = "<html
|
77
|
+
html = "<html><head><meta http-equiv='refresh' content='#{@long}'/></head></html>"
|
77
78
|
File.write(path, html)
|
78
|
-
Jekyll.logger.
|
79
|
+
Jekyll.logger.debug("HTML #{path.inspect} -> #{@long.inspect}")
|
79
80
|
true
|
80
81
|
end
|
81
82
|
end
|