jekyll-scholar 6.1.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/details.feature +4 -4
- data/features/grouping.feature +1 -1
- data/features/removeduplicate.feature +131 -0
- data/lib/jekyll/scholar/defaults.rb +2 -0
- data/lib/jekyll/scholar/utilities.rb +18 -1
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 851a94e35cec0f98f3242345376008c32ce4d842733291176b0c1aec9839b9a5
|
4
|
+
data.tar.gz: 790bdcb509be73f07ad33cf05af48e7d5a66aaeba25910f5d2fbbd09d9066bff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e186f78e25cab5dedf1e9dcba3a455b7bdb6701077517e0770f007972d6ab22d6850c44e205c6f761ce32cfa2e68463494c53b3b617592517afdde8234117f5
|
7
|
+
data.tar.gz: 20b8a68f6fa78640dd3bcf4cedc5a730f4c93deefa2432445895cd4c88495c248007c4806a66696d9bfe6d8295583783f28ade1b5ddd5cc558ec93a8ba3f1f1d
|
data/features/details.feature
CHANGED
@@ -216,7 +216,7 @@ Feature: Details
|
|
216
216
|
@book{b,
|
217
217
|
title = {The Ruby Programming Language},
|
218
218
|
author = {Flanagan, David and Matsumoto, Yukihiro},
|
219
|
-
year = {
|
219
|
+
year = {2018},
|
220
220
|
publisher = {O'Reilly Media}
|
221
221
|
}
|
222
222
|
"""
|
@@ -355,7 +355,7 @@ Feature: Details
|
|
355
355
|
@book{ruby,
|
356
356
|
title = {The Ruby Programming Language},
|
357
357
|
author = {Flanagan, David and Matsumoto, Yukihiro},
|
358
|
-
year = {
|
358
|
+
year = {2018},
|
359
359
|
publisher = {O'Reilly Media}
|
360
360
|
}
|
361
361
|
"""
|
@@ -381,9 +381,9 @@ Feature: Details
|
|
381
381
|
Then the _site directory should exist
|
382
382
|
And the "_site/scholar/index.html" file should exist
|
383
383
|
And I should see "<a[^>]+href=\"/bibliography/2008/10.0000/1111/\">" in "_site/scholar/index.html"
|
384
|
-
And I should see "<a[^>]+href=\"/bibliography/
|
384
|
+
And I should see "<a[^>]+href=\"/bibliography/2018/ruby/\">" in "_site/scholar/index.html"
|
385
385
|
And the "_site/bibliography/2008/10.0000/1111/index.html" file should exist
|
386
|
-
And the "_site/bibliography/
|
386
|
+
And the "_site/bibliography/2018/ruby/index.html" file should exist
|
387
387
|
|
388
388
|
@generators @parse_months
|
389
389
|
Scenario: Months are parsed by default
|
data/features/grouping.feature
CHANGED
@@ -0,0 +1,131 @@
|
|
1
|
+
Feature: BibTeX
|
2
|
+
As a scholar who likes to blog
|
3
|
+
I want to publish my BibTeX bibliography on my blog
|
4
|
+
In order to share my awesome references with my peers
|
5
|
+
|
6
|
+
@tags @bibliography
|
7
|
+
Scenario: Duplicates should not be removed by default
|
8
|
+
Given I have a scholar configuration with:
|
9
|
+
| key | value |
|
10
|
+
| source | ./_bibliography |
|
11
|
+
| bibliography_list_tag | ol |
|
12
|
+
And I have a "_bibliography" directory
|
13
|
+
And I have a file "_bibliography/references.bib":
|
14
|
+
"""
|
15
|
+
@book{ruby,
|
16
|
+
title = {The Ruby Programming Language},
|
17
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
18
|
+
year = {2008},
|
19
|
+
publisher = {O'Reilly Media}
|
20
|
+
}
|
21
|
+
|
22
|
+
@book{ruby,
|
23
|
+
title = {The Ruby Programming Language},
|
24
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
25
|
+
year = {2008},
|
26
|
+
publisher = {O'Reilly Media}
|
27
|
+
}
|
28
|
+
|
29
|
+
@book{ruby,
|
30
|
+
title = {Smalltalk Best Practice Patterns},
|
31
|
+
author = {Kent Beck},
|
32
|
+
year = {1996},
|
33
|
+
publisher = {Prentice Hall}
|
34
|
+
}
|
35
|
+
"""
|
36
|
+
And I have a page "scholar.html":
|
37
|
+
"""
|
38
|
+
---
|
39
|
+
---
|
40
|
+
{% bibliography_count -f references %}
|
41
|
+
|
42
|
+
"""
|
43
|
+
When I run jekyll
|
44
|
+
Then the _site directory should exist
|
45
|
+
And the "_site/scholar.html" file should exist
|
46
|
+
And I should see "3" in "_site/scholar.html"
|
47
|
+
|
48
|
+
@tags @bibliography
|
49
|
+
Scenario: Duplicates should be removed
|
50
|
+
Given I have a scholar configuration with:
|
51
|
+
| key | value |
|
52
|
+
| source | ./_bibliography |
|
53
|
+
| remove_duplicates | true |
|
54
|
+
| bibliography_list_tag | ol |
|
55
|
+
And I have a "_bibliography" directory
|
56
|
+
And I have a file "_bibliography/references.bib":
|
57
|
+
"""
|
58
|
+
@book{ruby,
|
59
|
+
title = {The Ruby Programming Language},
|
60
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
61
|
+
year = {2008},
|
62
|
+
publisher = {O'Reilly Media}
|
63
|
+
}
|
64
|
+
|
65
|
+
@book{ruby,
|
66
|
+
title = {The Ruby Programming Language},
|
67
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
68
|
+
year = {2008},
|
69
|
+
publisher = {O'Reilly Media}
|
70
|
+
}
|
71
|
+
|
72
|
+
@book{ruby,
|
73
|
+
title = {Smalltalk Best Practice Patterns},
|
74
|
+
author = {Kent Beck},
|
75
|
+
year = {1996},
|
76
|
+
publisher = {Prentice Hall}
|
77
|
+
}
|
78
|
+
"""
|
79
|
+
And I have a page "scholar.html":
|
80
|
+
"""
|
81
|
+
---
|
82
|
+
---
|
83
|
+
{% bibliography_count -f references --remove_duplicates %}
|
84
|
+
|
85
|
+
"""
|
86
|
+
When I run jekyll
|
87
|
+
Then the _site directory should exist
|
88
|
+
And the "_site/scholar.html" file should exist
|
89
|
+
And I should see "2" in "_site/scholar.html"
|
90
|
+
|
91
|
+
@tags @bibliography
|
92
|
+
Scenario: Remove duplicates by year
|
93
|
+
Given I have a scholar configuration with:
|
94
|
+
| key | value |
|
95
|
+
| source | ./_bibliography |
|
96
|
+
| remove_duplicates | true |
|
97
|
+
| bibliography_list_tag | ol |
|
98
|
+
And I have a "_bibliography" directory
|
99
|
+
And I have a file "_bibliography/references.bib":
|
100
|
+
"""
|
101
|
+
@book{ruby,
|
102
|
+
title = {The Ruby Programming Language},
|
103
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
104
|
+
year = {1996},
|
105
|
+
publisher = {O'Reilly Media}
|
106
|
+
}
|
107
|
+
|
108
|
+
@book{ruby,
|
109
|
+
title = {The Ruby Programming Language},
|
110
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
111
|
+
year = {2008},
|
112
|
+
publisher = {O'Reilly Media}
|
113
|
+
}
|
114
|
+
|
115
|
+
@book{ruby,
|
116
|
+
title = {Smalltalk Best Practice Patterns},
|
117
|
+
author = {Kent Beck},
|
118
|
+
year = {1996},
|
119
|
+
publisher = {Prentice Hall}
|
120
|
+
}
|
121
|
+
"""
|
122
|
+
And I have a page "scholar.html":
|
123
|
+
"""
|
124
|
+
---
|
125
|
+
---
|
126
|
+
{% bibliography_count -f references -r year %}
|
127
|
+
"""
|
128
|
+
When I run jekyll
|
129
|
+
Then the _site directory should exist
|
130
|
+
And the "_site/scholar.html" file should exist
|
131
|
+
And I should see "2" in "_site/scholar.html"
|
@@ -32,6 +32,7 @@ module Jekyll
|
|
32
32
|
return if arguments.nil? || arguments.empty?
|
33
33
|
|
34
34
|
parser = OptionParser.new do |opts|
|
35
|
+
|
35
36
|
opts.on('-c', '--cited') do |cited|
|
36
37
|
@cited = true
|
37
38
|
end
|
@@ -40,6 +41,11 @@ module Jekyll
|
|
40
41
|
@cited, @skip_sort = true, true
|
41
42
|
end
|
42
43
|
|
44
|
+
opts.on('-r', '--remove_duplicates [MATCH_FIELDS]') do |match_field|
|
45
|
+
@remove_duplicates = true
|
46
|
+
@match_fields = match_field.split(/,\s+/) if not match_field.nil?
|
47
|
+
end
|
48
|
+
|
43
49
|
opts.on('-A', '--suppress_author') do |cited|
|
44
50
|
@suppress_author = true
|
45
51
|
end
|
@@ -102,7 +108,7 @@ module Jekyll
|
|
102
108
|
end
|
103
109
|
end
|
104
110
|
|
105
|
-
argv = arguments.split(/(\B-[
|
111
|
+
argv = arguments.split(/(\B-[cCfhqptTsgGOlLomAr]|\B--(?:cited(_in_order)?|bibliography_list_tag|file|query|prefix|text|style|group_(?:by|order)|type_order|template|locator|label|offset|max|suppress_author|remove_duplicates|))/)
|
106
112
|
|
107
113
|
parser.parse argv.map(&:strip).reject(&:empty?)
|
108
114
|
end
|
@@ -120,6 +126,10 @@ module Jekyll
|
|
120
126
|
end
|
121
127
|
|
122
128
|
|
129
|
+
def match_fields
|
130
|
+
@match_fields ||= []
|
131
|
+
end
|
132
|
+
|
123
133
|
def locators
|
124
134
|
@locators ||= []
|
125
135
|
end
|
@@ -173,6 +183,9 @@ module Jekyll
|
|
173
183
|
@bibliography.join if join_strings? && replace_strings?
|
174
184
|
end
|
175
185
|
|
186
|
+
# Remove duplicate entries
|
187
|
+
@bibliography.uniq!(*match_fields) if remove_duplicates?
|
188
|
+
|
176
189
|
@bibliography
|
177
190
|
end
|
178
191
|
|
@@ -352,6 +365,10 @@ module Jekyll
|
|
352
365
|
@month_names = config['month_names'].nil? ? Date::MONTHNAMES : config['month_names'].unshift(nil)
|
353
366
|
end
|
354
367
|
|
368
|
+
def remove_duplicates?
|
369
|
+
@remove_duplicates || config['remove_duplicates']
|
370
|
+
end
|
371
|
+
|
355
372
|
def suppress_author?
|
356
373
|
!!@suppress_author
|
357
374
|
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: 6.
|
4
|
+
version: 6.2.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: 2019-
|
11
|
+
date: 2019-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- features/layout.feature
|
105
105
|
- features/multiple_files.feature
|
106
106
|
- features/reference.feature
|
107
|
+
- features/removeduplicate.feature
|
107
108
|
- features/repository.feature
|
108
109
|
- features/sorting.feature
|
109
110
|
- features/step_definitions/jekyll_steps.rb
|
@@ -171,6 +172,7 @@ test_files:
|
|
171
172
|
- features/layout.feature
|
172
173
|
- features/multiple_files.feature
|
173
174
|
- features/reference.feature
|
175
|
+
- features/removeduplicate.feature
|
174
176
|
- features/repository.feature
|
175
177
|
- features/sorting.feature
|
176
178
|
- features/step_definitions/jekyll_steps.rb
|