jekyll-age 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-age.rb +27 -27
  3. metadata +46 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dde951884618a490e5632e60273fe9ed0378a450bc72387782b52921af3834b
4
- data.tar.gz: c260a92e48dfd12679a98faaafd978738a78189e0ba34ea1de1066b5c2c7d33a
3
+ metadata.gz: 56e93635dc148b571143f8908fc738df4f68cf481a83b58c4d34928017d0c9e4
4
+ data.tar.gz: 051702bf5ca545f64b136fd8fc7b5e4838d0bdd81cfb5dfcae4090bea8eacc46
5
5
  SHA512:
6
- metadata.gz: 27ebc99b58c34efe2aeed4ed695a0e5cc4690e86f55055cfc22373613c1e0dbcabda09e48159c616c1c8687ffb59f3cbe01545237528fefd7458a10a9ff7ed07
7
- data.tar.gz: fece280ec8305a0ba8b2c0e99542e2a161c1fe36048867ae3a9cfe8cb2456816b07ccfba4ed950b881f6efa91043bd123b999c534633c75634ac69467b8dc304
6
+ metadata.gz: 2d1f4fe8e97cfa57131ffdd0d3a12782f0efe5951b5fb0e1bb5599fa1bc925daaa5245ac865d8072ab60e2d91a795bc213944de156984bf5f58a98c5cf9d9288
7
+ data.tar.gz: 3cda7860c82b1f441599efe6d8b040bada522fcb02f4ae8753dfacee04698b0c5dc4e9a3fad98ac52dff48eb28ca507a4097105c215c62c08a6befb91ce84186
data/lib/jekyll-age.rb CHANGED
@@ -1,28 +1,28 @@
1
- module Jekyll
2
- class RenderAgeTag < Liquid::Tag
3
-
4
- def initialize(tag_name, date, tokens)
5
- super
6
- @date = validate_date(date)
7
- end
8
-
9
- def render(context)
10
- age = getAge(@date)
11
- "#{age}"
12
- end
13
-
14
- def validate_date(date)
15
- Date.parse(date.to_s)
16
- end
17
-
18
- def getAge(from, to = Date.today)
19
- years = to.year - from.year
20
- if to.yday < from.yday
21
- years -= 1
22
- end
23
- return years;
24
- end
25
- end
26
- end
27
-
1
+ module Jekyll
2
+ class RenderAgeTag < Liquid::Tag
3
+
4
+ def initialize(tag_name, date, tokens)
5
+ super
6
+ @date = validate_date(date)
7
+ end
8
+
9
+ def render(context)
10
+ age = get_age(@date)
11
+ "#{age}"
12
+ end
13
+
14
+ def self.validate_date(date)
15
+ Date.parse(date.to_s)
16
+ end
17
+
18
+ def self.get_age(from, to = Date.today)
19
+ years = to.year - from.year
20
+ if to.yday < from.yday
21
+ years -= 1
22
+ end
23
+ return years;
24
+ end
25
+ end
26
+ end
27
+
28
28
  Liquid::Template.register_tag('age', Jekyll::RenderAgeTag)
metadata CHANGED
@@ -1,15 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-age
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Kühnel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-10 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2019-11-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.3'
13
55
  description: Provides an age tag for jekyll/liquid
14
56
  email: johannes@kuehnel.co.at
15
57
  executables: []
@@ -36,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
78
  - !ruby/object:Gem::Version
37
79
  version: '0'
38
80
  requirements: []
39
- rubyforge_project:
40
- rubygems_version: 2.7.6.2
81
+ rubygems_version: 3.0.3
41
82
  signing_key:
42
83
  specification_version: 4
43
84
  summary: Age tag for jekyll