jekyll-scholar 5.5.1 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/grouping.feature +68 -4
- data/features/support/env.rb +2 -2
- data/lib/jekyll/scholar/utilities.rb +16 -8
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abed0619494c665e22a5e4bd0b3aafb28e03ea7b
|
4
|
+
data.tar.gz: 2bd51b0607843ddc861a026a17a68f10c44d31f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4d764609ff7b540ac0b06319e8f2384e5401ab4f9d736abf64cfeb1889a16794282ea4f9de5e222eea3a288efb261ad37a396e804bef977b398fabfa3b77dfe
|
7
|
+
data.tar.gz: 1c45100a39f4ee8173170d534ae64b916d433a01452de1a8c64f6b7f15327757005f4ed52801c5bc94ec547bd8c2eb2937df80fbd9bd790148b4d4e087dd7010
|
data/features/grouping.feature
CHANGED
@@ -40,7 +40,7 @@ Feature: Grouping BibTeX Bibliographies
|
|
40
40
|
Given I have a scholar configuration with:
|
41
41
|
| key | value |
|
42
42
|
| group_by | year |
|
43
|
-
| group_order | ascending |
|
43
|
+
| group_order | ascending |
|
44
44
|
And I have a "_bibliography" directory
|
45
45
|
And I have a file "_bibliography/references.bib":
|
46
46
|
"""
|
@@ -73,7 +73,7 @@ Feature: Grouping BibTeX Bibliographies
|
|
73
73
|
Given I have a scholar configuration with:
|
74
74
|
| key | value |
|
75
75
|
| group_by | year |
|
76
|
-
| group_order | descending |
|
76
|
+
| group_order | descending |
|
77
77
|
And I have a "_bibliography" directory
|
78
78
|
And I have a file "_bibliography/references.bib":
|
79
79
|
"""
|
@@ -106,7 +106,7 @@ Feature: Grouping BibTeX Bibliographies
|
|
106
106
|
Given I have a scholar configuration with:
|
107
107
|
| key | value |
|
108
108
|
| group_by | year,month |
|
109
|
-
| group_order | descending,ascending |
|
109
|
+
| group_order | descending,ascending |
|
110
110
|
And I have a "_bibliography" directory
|
111
111
|
And I have a file "_bibliography/references.bib":
|
112
112
|
"""
|
@@ -301,4 +301,68 @@ Feature: Grouping BibTeX Bibliographies
|
|
301
301
|
Then I should see "Januar" in "_site/scholar.html"
|
302
302
|
And I should not see "January" in "_site/scholar.html"
|
303
303
|
And I should see "Dezember" in "_site/scholar.html"
|
304
|
-
And I should not see "December" in "_site/scholar.html"
|
304
|
+
And I should not see "December" in "_site/scholar.html"
|
305
|
+
|
306
|
+
@tags @grouping
|
307
|
+
Scenario: Local grouping override - no grouping
|
308
|
+
Given I have a scholar configuration with:
|
309
|
+
| group_by | year |
|
310
|
+
And I have a "_bibliography" directory
|
311
|
+
And I have a file "_bibliography/references.bib":
|
312
|
+
"""
|
313
|
+
@book{ruby1,
|
314
|
+
title = {The Ruby Programming Language},
|
315
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
316
|
+
year = {2008},
|
317
|
+
publisher = {O'Reilly Media}
|
318
|
+
}
|
319
|
+
@book{ruby2,
|
320
|
+
title = {The Ruby Programming Language},
|
321
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
322
|
+
year = {2007},
|
323
|
+
publisher = {O'Reilly Media}
|
324
|
+
}
|
325
|
+
"""
|
326
|
+
And I have a page "scholar.html":
|
327
|
+
"""
|
328
|
+
---
|
329
|
+
---
|
330
|
+
{% bibliography -f references --group_by none %}
|
331
|
+
"""
|
332
|
+
When I run jekyll
|
333
|
+
Then the _site directory should exist
|
334
|
+
And the "_site/scholar.html" file should exist
|
335
|
+
Then I should not see "<h2 class=\"bibliography\">2007</h2>" in "_site/scholar.html"
|
336
|
+
And I should not see "<h2 class=\"bibliography\">2008</h2>" in "_site/scholar.html"
|
337
|
+
|
338
|
+
@tags @grouping
|
339
|
+
Scenario: Local grouping override - grouping by year
|
340
|
+
Given I have a scholar configuration with:
|
341
|
+
| group_by | none |
|
342
|
+
And I have a "_bibliography" directory
|
343
|
+
And I have a file "_bibliography/references.bib":
|
344
|
+
"""
|
345
|
+
@book{ruby1,
|
346
|
+
title = {The Ruby Programming Language},
|
347
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
348
|
+
year = {2008},
|
349
|
+
publisher = {O'Reilly Media}
|
350
|
+
}
|
351
|
+
@book{ruby2,
|
352
|
+
title = {The Ruby Programming Language},
|
353
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
354
|
+
year = {2007},
|
355
|
+
publisher = {O'Reilly Media}
|
356
|
+
}
|
357
|
+
"""
|
358
|
+
And I have a page "scholar.html":
|
359
|
+
"""
|
360
|
+
---
|
361
|
+
---
|
362
|
+
{% bibliography -f references --group_by year %}
|
363
|
+
"""
|
364
|
+
When I run jekyll
|
365
|
+
Then the _site directory should exist
|
366
|
+
And the "_site/scholar.html" file should exist
|
367
|
+
Then I should see "<h2 class=\"bibliography\">2007</h2>" in "_site/scholar.html"
|
368
|
+
And I should see "<h2 class=\"bibliography\">2008</h2>" in "_site/scholar.html"
|
data/features/support/env.rb
CHANGED
@@ -85,12 +85,16 @@ module Jekyll
|
|
85
85
|
@style = style
|
86
86
|
end
|
87
87
|
|
88
|
+
opts.on('-g', '--group_by GROUP') do |group_by|
|
89
|
+
@group_by = group_by
|
90
|
+
end
|
91
|
+
|
88
92
|
opts.on('-T', '--template TEMPLATE') do |template|
|
89
93
|
@bibliography_template = template
|
90
94
|
end
|
91
95
|
end
|
92
96
|
|
93
|
-
argv = arguments.split(/(\B-[
|
97
|
+
argv = arguments.split(/(\B-[cCfqrptTsglomA]|\B--(?:cited(_in_order)?|file|query|relative|prefix|text|style|group_by|template|locator|offset|max|suppress_author|))/)
|
94
98
|
|
95
99
|
parser.parse argv.map(&:strip).reject(&:empty?)
|
96
100
|
end
|
@@ -198,10 +202,14 @@ module Jekyll
|
|
198
202
|
.flatten
|
199
203
|
end
|
200
204
|
|
205
|
+
def group_by
|
206
|
+
@group_by ||= config['group_by']
|
207
|
+
end
|
208
|
+
|
201
209
|
def group?
|
202
|
-
|
210
|
+
group_by != 'none'
|
203
211
|
end
|
204
|
-
|
212
|
+
|
205
213
|
def group(ungrouped)
|
206
214
|
def grouper(items,keys,order)
|
207
215
|
groups = items
|
@@ -218,16 +226,16 @@ module Jekyll
|
|
218
226
|
end
|
219
227
|
grouper(ungrouped,group_keys,group_order)
|
220
228
|
end
|
221
|
-
|
229
|
+
|
222
230
|
def group_keys
|
223
231
|
return @group_keys unless @group_keys.nil?
|
224
232
|
|
225
|
-
@group_keys = Array(
|
233
|
+
@group_keys = Array(group_by)
|
226
234
|
.map { |key| key.to_s.split(/\s*,\s*/) }
|
227
235
|
.flatten
|
228
236
|
.map { |key| key == 'month' ? 'month_numeric' : key }
|
229
237
|
end
|
230
|
-
|
238
|
+
|
231
239
|
def group_order
|
232
240
|
return @group_order unless @group_order.nil?
|
233
241
|
|
@@ -235,7 +243,7 @@ module Jekyll
|
|
235
243
|
.map { |key| key.to_s.split(/\s*,\s*/) }
|
236
244
|
.flatten
|
237
245
|
end
|
238
|
-
|
246
|
+
|
239
247
|
def group_compare(key,v1,v2)
|
240
248
|
case key
|
241
249
|
when 'type'
|
@@ -254,7 +262,7 @@ module Jekyll
|
|
254
262
|
v1 <=> v2
|
255
263
|
end
|
256
264
|
end
|
257
|
-
|
265
|
+
|
258
266
|
def group_value(key,item)
|
259
267
|
case key
|
260
268
|
when 'type'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-scholar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01
|
11
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|