jekyll-scholar 5.6.0 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/bibtex.feature +27 -0
- data/features/grouping.feature +5 -2
- data/lib/jekyll/scholar/utilities.rb +29 -13
- 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: 5b7e5e1c9176f9047d2e7492f07b212bc6e247e7
|
4
|
+
data.tar.gz: 106254e255857e66c6e5b81ebbb95c74876c9fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f2d2d642250db134aa6a63676ee588d9092cabf66e185c124275864e14df07316ee0121df3d0b0c5e59ee8e2bc4df23160eb589564f9bed00d4fb546f0bc95b
|
7
|
+
data.tar.gz: ffffd80dabf38c39cebdd07a7052ede50a7cc30e96f48a7da4e340e7d231f2a2794ad08b0270bf16f1d8e5e536f6993ec08f62f67c59c5b673fe17f3bc2ddb3e
|
data/features/bibtex.feature
CHANGED
@@ -142,6 +142,33 @@ Feature: BibTeX
|
|
142
142
|
And the "_site/scholar.html" file should exist
|
143
143
|
And I should see "<abbr>1 book \[ruby\]</abbr>Matsumoto" in "_site/scholar.html"
|
144
144
|
|
145
|
+
@tags @bibliography @config @template
|
146
|
+
Scenario: Simple Bibliography With Custom Template
|
147
|
+
Given I have a scholar configuration with:
|
148
|
+
| key | value |
|
149
|
+
| source | ./_bibliography |
|
150
|
+
| bibliography_template | <abbr>{{index}} {{entry.type}} [{{key}}]</abbr>{{entry.author_array[1].last}} |
|
151
|
+
And I have a "_bibliography" directory
|
152
|
+
And I have a file "_bibliography/references.bib":
|
153
|
+
"""
|
154
|
+
@book{ruby,
|
155
|
+
title = {The Ruby Programming Language},
|
156
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
157
|
+
year = {2008},
|
158
|
+
publisher = {O'Reilly Media}
|
159
|
+
}
|
160
|
+
"""
|
161
|
+
And I have a page "scholar.html":
|
162
|
+
"""
|
163
|
+
---
|
164
|
+
---
|
165
|
+
{% bibliography -f references %}
|
166
|
+
"""
|
167
|
+
When I run jekyll
|
168
|
+
Then the _site directory should exist
|
169
|
+
And the "_site/scholar.html" file should exist
|
170
|
+
And I should see "<abbr>1 book \[ruby\]</abbr>Matsumoto" in "_site/scholar.html"
|
171
|
+
|
145
172
|
@tags @filter
|
146
173
|
Scenario: Filtered Bibliography Loaded From Default Directory
|
147
174
|
Given I have a scholar configuration with:
|
data/features/grouping.feature
CHANGED
@@ -338,7 +338,9 @@ Feature: Grouping BibTeX Bibliographies
|
|
338
338
|
@tags @grouping
|
339
339
|
Scenario: Local grouping override - grouping by year
|
340
340
|
Given I have a scholar configuration with:
|
341
|
-
|
|
341
|
+
| key | value |
|
342
|
+
| group_by | none |
|
343
|
+
| group_order | ascending |
|
342
344
|
And I have a "_bibliography" directory
|
343
345
|
And I have a file "_bibliography/references.bib":
|
344
346
|
"""
|
@@ -359,10 +361,11 @@ Feature: Grouping BibTeX Bibliographies
|
|
359
361
|
"""
|
360
362
|
---
|
361
363
|
---
|
362
|
-
{% bibliography -f references --group_by year %}
|
364
|
+
{% bibliography -f references --group_by year --group_order descending %}
|
363
365
|
"""
|
364
366
|
When I run jekyll
|
365
367
|
Then the _site directory should exist
|
366
368
|
And the "_site/scholar.html" file should exist
|
367
369
|
Then I should see "<h2 class=\"bibliography\">2007</h2>" in "_site/scholar.html"
|
368
370
|
And I should see "<h2 class=\"bibliography\">2008</h2>" in "_site/scholar.html"
|
371
|
+
And "2008" should come before "2007" in "_site/scholar.html"
|
@@ -89,12 +89,20 @@ module Jekyll
|
|
89
89
|
@group_by = group_by
|
90
90
|
end
|
91
91
|
|
92
|
+
opts.on('-G', '--group_order ORDER') do |group_order|
|
93
|
+
self.group_order = group_order
|
94
|
+
end
|
95
|
+
|
96
|
+
opts.on('-O', '--type_order ORDER') do |type_order|
|
97
|
+
@group_by = type_order
|
98
|
+
end
|
99
|
+
|
92
100
|
opts.on('-T', '--template TEMPLATE') do |template|
|
93
101
|
@bibliography_template = template
|
94
102
|
end
|
95
103
|
end
|
96
104
|
|
97
|
-
argv = arguments.split(/(\B-[
|
105
|
+
argv = arguments.split(/(\B-[cCfqrptTsgGOlomA]|\B--(?:cited(_in_order)?|file|query|relative|prefix|text|style|group_(?:by|order)|type_order|template|locator|offset|max|suppress_author|))/)
|
98
106
|
|
99
107
|
parser.parse argv.map(&:strip).reject(&:empty?)
|
100
108
|
end
|
@@ -181,7 +189,7 @@ module Jekyll
|
|
181
189
|
end
|
182
190
|
.find { |c| c != 0 } || 0
|
183
191
|
end
|
184
|
-
|
192
|
+
|
185
193
|
sorted
|
186
194
|
end
|
187
195
|
|
@@ -211,20 +219,21 @@ module Jekyll
|
|
211
219
|
end
|
212
220
|
|
213
221
|
def group(ungrouped)
|
214
|
-
def grouper(items,keys,order)
|
215
|
-
groups = items
|
216
|
-
.
|
217
|
-
|
218
|
-
|
222
|
+
def grouper(items, keys, order)
|
223
|
+
groups = items.group_by do |item|
|
224
|
+
group_value(keys.first, item)
|
225
|
+
end
|
226
|
+
|
219
227
|
if keys.count == 1
|
220
228
|
groups
|
221
229
|
else
|
222
|
-
groups.merge(groups) do |key,items|
|
223
|
-
grouper(items,keys.drop(1),order.drop(1))
|
230
|
+
groups.merge(groups) do |key, items|
|
231
|
+
grouper(items, keys.drop(1), order.drop(1))
|
224
232
|
end
|
225
233
|
end
|
226
234
|
end
|
227
|
-
|
235
|
+
|
236
|
+
grouper(ungrouped, group_keys, group_order)
|
228
237
|
end
|
229
238
|
|
230
239
|
def group_keys
|
@@ -237,9 +246,12 @@ module Jekyll
|
|
237
246
|
end
|
238
247
|
|
239
248
|
def group_order
|
240
|
-
|
249
|
+
self.group_order = config['group_order'] if @group_order.nil?
|
250
|
+
@group_order
|
251
|
+
end
|
241
252
|
|
242
|
-
|
253
|
+
def group_order=(value)
|
254
|
+
@group_order = Array(value)
|
243
255
|
.map { |key| key.to_s.split(/\s*,\s*/) }
|
244
256
|
.flatten
|
245
257
|
end
|
@@ -286,7 +298,7 @@ module Jekyll
|
|
286
298
|
.map { |key| key.to_s.split(/\s*,\s*/) }
|
287
299
|
.flatten
|
288
300
|
end
|
289
|
-
|
301
|
+
|
290
302
|
def group_name(key,value)
|
291
303
|
case key
|
292
304
|
when 'type'
|
@@ -485,10 +497,14 @@ module Jekyll
|
|
485
497
|
e[key.to_s] = value.to_s
|
486
498
|
|
487
499
|
if value.is_a?(BibTeX::Names)
|
500
|
+
e["#{key}_array"] = arr = []
|
488
501
|
value.each.with_index do |name, idx|
|
502
|
+
parts = {}
|
489
503
|
name.each_pair do |k, v|
|
490
504
|
e["#{key}_#{idx}_#{k}"] = v.to_s
|
505
|
+
parts[k.to_s] = v.to_s
|
491
506
|
end
|
507
|
+
arr << parts
|
492
508
|
end
|
493
509
|
end
|
494
510
|
end
|
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.7.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-02-
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|