jekyll-ical-tag 1.0.7 → 1.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd1beec28fa33ea701a64a6ef052b8c5fe215254f8ee5a7132a859156d395205
4
- data.tar.gz: d2f145cfdf30bb6e15be692eba8541fa0a030e5770b9acad53d037405e088c16
3
+ metadata.gz: 0d234777e1efb40a2d7a4d2c3ece936a21a9b22521f691db615cbefa693e94f9
4
+ data.tar.gz: 27ec683fdeb6598ccc15604e3426e101efc94d210dd030d075a1fb90bf907853
5
5
  SHA512:
6
- metadata.gz: 462302c862fedbc0dddac6fb4b21cccaf385ee7407ed3feda606e425c95682b5cd2b1585df02b01d71575dd0882cc0a0c2018fa83522de7dc4393f034b9e5d7e
7
- data.tar.gz: a307c6fcd3de6ac28ce920d54714646213cec7ed39c31590586f17e634bd5fc1c0bcab2943d6e6fc029844379fabf6a5351d13285f9a4e0997fe86a8997c85b5
6
+ metadata.gz: 47e65509012af13fe385cbdba02675819d1ba82ff361e9be6aa23dd26f587f9b17a13b8e2d5f82c5b08bbf8e0cf0cc6a348a9039e6e3c3f199bebadee6bb3444
7
+ data.tar.gz: 8efcb4b61f6589721b242595b855992478985ec57b3915da68d5e9c09056991066039ed22485b8ac1b35f9469a2598aacc97e45e6929b723331064646ce4a1ed
data/README.md CHANGED
@@ -39,6 +39,7 @@ plugins:
39
39
 
40
40
  - `before_date` - limits returned events to dates before a specific date. This gets parsed with Ruby's Time.parse (e.g. 01-01-2018)
41
41
  - `after_date` - limits returned events to dates before a specific date. This gets parsed with Ruby's Time.parse (e.g. 01-01-2018).
42
+ - `limit` - limits the number of returned events to the first N events matching the specified criteria. For example, `{% ical url: https://example.com/events.ics only_future:true limit:5 %}` returns the first five future events.
42
43
 
43
44
  ## Event Attributes:
44
45
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  class IcalTag < Liquid::Block
5
- VERSION = "1.0.7"
5
+ VERSION = "1.0.8"
6
6
  end
7
7
  end
@@ -18,6 +18,7 @@ module Jekyll
18
18
  @markup = markup
19
19
 
20
20
  scan_attributes!
21
+ set_limit!
21
22
  set_reverse!
22
23
  set_url!
23
24
  set_only!
@@ -37,6 +38,9 @@ module Jekyll
37
38
  parser = CalendarLimiter.new(parser, after_date: @after_date)
38
39
 
39
40
  events = parser.events
41
+ if @limit
42
+ events = events.first(@limit)
43
+ end
40
44
  length = events.length
41
45
 
42
46
  context.stack do
@@ -93,6 +97,14 @@ module Jekyll
93
97
  end
94
98
  end
95
99
 
100
+ def set_limit!
101
+ if @attributes["limit"]
102
+ @limit = @attributes["limit"].to_i
103
+ else
104
+ @limit = nil
105
+ end
106
+ end
107
+
96
108
  def set_reverse!
97
109
  @reverse = @attributes["order"] == "reverse"
98
110
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-ical-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricky Chilcott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll