jekyll-scholar 5.10.3 → 5.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -4
- data/features/186.feature +120 -0
- data/features/191.feature +108 -0
- data/features/215.feature +178 -0
- data/lib/jekyll-scholar.rb +1 -0
- data/lib/jekyll/scholar.rb +1 -0
- data/lib/jekyll/scholar/tags/bibliography.rb +5 -27
- data/lib/jekyll/scholar/tags/bibliography_count.rb +29 -0
- data/lib/jekyll/scholar/utilities.rb +48 -3
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a12c04213d5d4a7f2b7e6915f4484a2b0cd50d6
|
4
|
+
data.tar.gz: b028593919ff9c53a799f814727bae13fd8ddb64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37de3db56995dd2a662b8606d07a597beba91df7454ca2139fc3238a9212a47e7222c5a91b154ea7ed028664ed52dd65d4c52a7d412f1dc172cf5c6c7d1062e1
|
7
|
+
data.tar.gz: f45693b66aea36d5af8aae6ad0210e5325fbf7cca0e60aeac77b9c4d4b010200999e5f56c84f8c7a70aed4fe1380ee6b06dfc4a27de4d644e2e3237800eab788
|
data/README.md
CHANGED
@@ -6,9 +6,6 @@ extensions to [Jekyll](http://jekyllrb.com/), the awesome, blog aware, static
|
|
6
6
|
site generator; it formats your bibliographies and reading lists for the web
|
7
7
|
and gives your blog posts citation super-powers.
|
8
8
|
|
9
|
-
For additional features you may also want to take a look at
|
10
|
-
[jekyll-scholar-extras](https://github.com/jgoodall/jekyll-scholar-extras).
|
11
|
-
|
12
9
|
[![Build Status](https://travis-ci.org/inukshuk/jekyll-scholar.png?branch=master)](https://travis-ci.org/inukshuk/jekyll-scholar)
|
13
10
|
[![Coverage Status](https://coveralls.io/repos/inukshuk/jekyll-scholar/badge.png)](https://coveralls.io/r/inukshuk/jekyll-scholar)
|
14
11
|
[![Dependency Status](https://gemnasium.com/inukshuk/jekyll-scholar.png)](https://gemnasium.com/inukshuk/jekyll-scholar)
|
@@ -51,7 +48,7 @@ to a file in your plugin directory (e.g., to `_plugins/ext.rb`):
|
|
51
48
|
Alternatively, add `jekyll-scholar` to your `gem` list in your Jekyll
|
52
49
|
configuration:
|
53
50
|
|
54
|
-
|
51
|
+
plugins: ['jekyll/scholar']
|
55
52
|
|
56
53
|
### Configuration
|
57
54
|
|
@@ -0,0 +1,120 @@
|
|
1
|
+
Feature: BibTeX
|
2
|
+
As a scholar who likes to blog
|
3
|
+
I want to reference cool papers and books from my bibliography
|
4
|
+
|
5
|
+
@tags @bibliography
|
6
|
+
Scenario: Simple bibliography count
|
7
|
+
Given I have a scholar configuration with:
|
8
|
+
| key | value |
|
9
|
+
| source | ./_bibliography |
|
10
|
+
And I have a "_bibliography" directory
|
11
|
+
And I have a file "_bibliography/references.bib":
|
12
|
+
"""
|
13
|
+
@book{smalltalk,
|
14
|
+
title = {Smalltalk Best Practice Patterns},
|
15
|
+
author = {Kent Beck},
|
16
|
+
year = {1996},
|
17
|
+
publisher = {Prentice Hall}
|
18
|
+
}
|
19
|
+
@book{ruby,
|
20
|
+
title = {The Ruby Programming Language},
|
21
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
22
|
+
year = {2008},
|
23
|
+
publisher = {O'Reilly Media}
|
24
|
+
}
|
25
|
+
"""
|
26
|
+
And I have a page "scholar.html":
|
27
|
+
"""
|
28
|
+
---
|
29
|
+
---
|
30
|
+
{% bibliography_count -f references %}
|
31
|
+
"""
|
32
|
+
When I run jekyll
|
33
|
+
Then the _site directory should exist
|
34
|
+
And the "_site/scholar.html" file should exist
|
35
|
+
And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
36
|
+
And I should not see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
37
|
+
And I should see "2" in "_site/scholar.html"
|
38
|
+
|
39
|
+
@tags @bibliography
|
40
|
+
Scenario: Simple bibliography count with query
|
41
|
+
Given I have a scholar configuration with:
|
42
|
+
| key | value |
|
43
|
+
| source | ./_bibliography |
|
44
|
+
And I have a "_bibliography" directory
|
45
|
+
And I have a file "_bibliography/references.bib":
|
46
|
+
"""
|
47
|
+
@book{smalltalk,
|
48
|
+
title = {Smalltalk Best Practice Patterns},
|
49
|
+
author = {Kent Beck},
|
50
|
+
year = {1996},
|
51
|
+
publisher = {Prentice Hall}
|
52
|
+
}
|
53
|
+
@book{ruby,
|
54
|
+
title = {The Ruby Programming Language v1},
|
55
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
56
|
+
year = {1998},
|
57
|
+
publisher = {O'Reilly Media}
|
58
|
+
}
|
59
|
+
@book{ruby2,
|
60
|
+
title = {The Ruby Programming Language v2},
|
61
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
62
|
+
year = {2008},
|
63
|
+
publisher = {O'Reilly Media}
|
64
|
+
}
|
65
|
+
"""
|
66
|
+
And I have a page "scholar.html":
|
67
|
+
"""
|
68
|
+
---
|
69
|
+
---
|
70
|
+
{% bibliography_count -f references --query @book[year <= 2000] %}
|
71
|
+
"""
|
72
|
+
When I run jekyll
|
73
|
+
Then the _site directory should exist
|
74
|
+
And the "_site/scholar.html" file should exist
|
75
|
+
And I should not see "<i>The Ruby Programming Language v1</i>" in "_site/scholar.html"
|
76
|
+
And I should not see "<i>The Ruby Programming Language v2/i>" in "_site/scholar.html"
|
77
|
+
And I should not see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
78
|
+
And I should see "2" in "_site/scholar.html"
|
79
|
+
|
80
|
+
@tags @bibliography
|
81
|
+
Scenario: Simple bibliography count with query with cited
|
82
|
+
Given I have a scholar configuration with:
|
83
|
+
| key | value |
|
84
|
+
| source | ./_bibliography |
|
85
|
+
And I have a "_bibliography" directory
|
86
|
+
And I have a file "_bibliography/references.bib":
|
87
|
+
"""
|
88
|
+
@book{smalltalk,
|
89
|
+
title = {Smalltalk Best Practice Patterns},
|
90
|
+
author = {Kent Beck},
|
91
|
+
year = {1996},
|
92
|
+
publisher = {Prentice Hall}
|
93
|
+
}
|
94
|
+
@book{ruby,
|
95
|
+
title = {The Ruby Programming Language v1},
|
96
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
97
|
+
year = {1998},
|
98
|
+
publisher = {O'Reilly Media}
|
99
|
+
}
|
100
|
+
@book{ruby2,
|
101
|
+
title = {The Ruby Programming Language v2},
|
102
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
103
|
+
year = {2008},
|
104
|
+
publisher = {O'Reilly Media}
|
105
|
+
}
|
106
|
+
"""
|
107
|
+
And I have a page "scholar.html":
|
108
|
+
"""
|
109
|
+
---
|
110
|
+
---
|
111
|
+
{% cite smalltalk %}
|
112
|
+
{% bibliography_count -f references --query @book[year <= 2000] --cited %}
|
113
|
+
"""
|
114
|
+
When I run jekyll
|
115
|
+
Then the _site directory should exist
|
116
|
+
And the "_site/scholar.html" file should exist
|
117
|
+
And I should not see "<i>The Ruby Programming Language v1</i>" in "_site/scholar.html"
|
118
|
+
And I should not see "<i>The Ruby Programming Language v2/i>" in "_site/scholar.html"
|
119
|
+
And I should not see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
120
|
+
And I should see "1" in "_site/scholar.html"
|
@@ -0,0 +1,108 @@
|
|
1
|
+
Feature: Interpolation in references?
|
2
|
+
As a scholar who likes to blog
|
3
|
+
I want to reference cool papers and books from my bibliography
|
4
|
+
|
5
|
+
@tags @reference @liquid @interpolate
|
6
|
+
Scenario: Interpolate liquid variables
|
7
|
+
Given I have a scholar configuration with:
|
8
|
+
| key | value |
|
9
|
+
| source | ./_bibliography |
|
10
|
+
| bibliography | my_references |
|
11
|
+
And I have a "_bibliography" directory
|
12
|
+
And I have a file "_bibliography/my_references.bib":
|
13
|
+
"""
|
14
|
+
@book{ruby,
|
15
|
+
title = {The Ruby Programming Language},
|
16
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
17
|
+
year = {2008},
|
18
|
+
publisher = {O'Reilly Media}
|
19
|
+
}
|
20
|
+
"""
|
21
|
+
And I have a page "scholar.html":
|
22
|
+
"""
|
23
|
+
---
|
24
|
+
---
|
25
|
+
{% assign key = 'ruby' %}
|
26
|
+
{% reference {{key}} %}
|
27
|
+
"""
|
28
|
+
When I run jekyll
|
29
|
+
Then the _site directory should exist
|
30
|
+
And the "_site/scholar.html" file should exist
|
31
|
+
And I should see "Matsumoto, Y. \(2008\). <i>The Ruby" in "_site/scholar.html"
|
32
|
+
|
33
|
+
@tags @reference @liquid @interpolate
|
34
|
+
Scenario: Interpolate liquid variables
|
35
|
+
Given I have a scholar configuration with:
|
36
|
+
| key | value |
|
37
|
+
| source | ./_bibliography |
|
38
|
+
And I have a "_bibliography" directory
|
39
|
+
And I have a file "_bibliography/my_references.bib":
|
40
|
+
"""
|
41
|
+
@book{smalltalk,
|
42
|
+
title = {Smalltalk Best Practice Patterns},
|
43
|
+
author = {Kent Beck},
|
44
|
+
year = {1996},
|
45
|
+
publisher = {Prentice Hall}
|
46
|
+
}
|
47
|
+
"""
|
48
|
+
And I have a file "_bibliography/references.bib":
|
49
|
+
"""
|
50
|
+
@book{ruby,
|
51
|
+
title = {The Ruby Programming Language},
|
52
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
53
|
+
year = {2008},
|
54
|
+
publisher = {O'Reilly Media}
|
55
|
+
}
|
56
|
+
"""
|
57
|
+
And I have a page "scholar.html":
|
58
|
+
"""
|
59
|
+
---
|
60
|
+
---
|
61
|
+
{% assign key = 'ruby' %}
|
62
|
+
{% reference {{key}} --file my_references %}
|
63
|
+
{% reference {{key}} --file references %}
|
64
|
+
"""
|
65
|
+
When I run jekyll
|
66
|
+
Then the _site directory should exist
|
67
|
+
And the "_site/scholar.html" file should exist
|
68
|
+
And I should not see "id=\"a-smalltalk\"" in "_site/scholar.html"
|
69
|
+
And I should see "Matsumoto, Y. \(2008\). <i>The Ruby" in "_site/scholar.html"
|
70
|
+
|
71
|
+
@tags @reference @liquid @interpolate
|
72
|
+
Scenario: Interpolate liquid variables
|
73
|
+
Given I have a scholar configuration with:
|
74
|
+
| key | value |
|
75
|
+
| source | ./_bibliography |
|
76
|
+
And I have a "_bibliography" directory
|
77
|
+
And I have a file "_bibliography/my_references.bib":
|
78
|
+
"""
|
79
|
+
@book{smalltalk,
|
80
|
+
title = {Smalltalk Best Practice Patterns},
|
81
|
+
author = {Kent Beck},
|
82
|
+
year = {1996},
|
83
|
+
publisher = {Prentice Hall}
|
84
|
+
}
|
85
|
+
"""
|
86
|
+
And I have a file "_bibliography/references.bib":
|
87
|
+
"""
|
88
|
+
@book{ruby,
|
89
|
+
title = {The Ruby Programming Language},
|
90
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
91
|
+
year = {2008},
|
92
|
+
publisher = {O'Reilly Media}
|
93
|
+
}
|
94
|
+
"""
|
95
|
+
And I have a page "scholar.html":
|
96
|
+
"""
|
97
|
+
---
|
98
|
+
---
|
99
|
+
{% assign key = 'smalltalk' %}
|
100
|
+
{% assign myfile = 'my_references' %}
|
101
|
+
{% reference {{key}} --file {{myfile}} %}
|
102
|
+
"""
|
103
|
+
When I run jekyll
|
104
|
+
Then the _site directory should exist
|
105
|
+
And the "_site/scholar.html" file should exist
|
106
|
+
And I should see "Smalltalk Best Practice Patterns" in "_site/scholar.html"
|
107
|
+
And I should not see "The Ruby Programming Language" in "_site/scholar.html"
|
108
|
+
|
@@ -0,0 +1,178 @@
|
|
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: Default bibliography_list_tag: ol
|
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
|
+
@book{smalltalk,
|
22
|
+
title = {Smalltalk Best Practice Patterns},
|
23
|
+
author = {Kent Beck},
|
24
|
+
year = {1996},
|
25
|
+
publisher = {Prentice Hall}
|
26
|
+
}
|
27
|
+
"""
|
28
|
+
And I have a page "scholar.html":
|
29
|
+
"""
|
30
|
+
---
|
31
|
+
---
|
32
|
+
{% bibliography -f references %}
|
33
|
+
"""
|
34
|
+
When I run jekyll
|
35
|
+
Then the _site directory should exist
|
36
|
+
And the "_site/scholar.html" file should exist
|
37
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
38
|
+
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
39
|
+
And I should see "<ol class=\"bibliography\">" in "_site/scholar.html"
|
40
|
+
And I should see "</ol>" in "_site/scholar.html"
|
41
|
+
|
42
|
+
@tags @bibliography
|
43
|
+
Scenario: Default bibliography_list_tag: ol with override
|
44
|
+
Given I have a scholar configuration with:
|
45
|
+
| key | value |
|
46
|
+
| source | ./_bibliography |
|
47
|
+
| bibliography_list_tag | ol |
|
48
|
+
And I have a "_bibliography" directory
|
49
|
+
And I have a file "_bibliography/references.bib":
|
50
|
+
"""
|
51
|
+
@book{ruby,
|
52
|
+
title = {The Ruby Programming Language},
|
53
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
54
|
+
year = {2008},
|
55
|
+
publisher = {O'Reilly Media}
|
56
|
+
}
|
57
|
+
@book{smalltalk,
|
58
|
+
title = {Smalltalk Best Practice Patterns},
|
59
|
+
author = {Kent Beck},
|
60
|
+
year = {1996},
|
61
|
+
publisher = {Prentice Hall}
|
62
|
+
}
|
63
|
+
"""
|
64
|
+
And I have a page "scholar.html":
|
65
|
+
"""
|
66
|
+
---
|
67
|
+
---
|
68
|
+
{% bibliography -f references %}
|
69
|
+
"""
|
70
|
+
And I have a page "scholar-ul.html":
|
71
|
+
"""
|
72
|
+
---
|
73
|
+
---
|
74
|
+
{% bibliography -f references --bibliography_list_tag ul %}
|
75
|
+
"""
|
76
|
+
|
77
|
+
When I run jekyll
|
78
|
+
Then the _site directory should exist
|
79
|
+
And the "_site/scholar.html" file should exist
|
80
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
81
|
+
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
82
|
+
And I should see "<ol class=\"bibliography\">" in "_site/scholar.html"
|
83
|
+
And I should see "</ol>" in "_site/scholar.html"
|
84
|
+
|
85
|
+
@tags @bibliography
|
86
|
+
Scenario: Default bibliography_list_tag: ol with override
|
87
|
+
Given I have a scholar configuration with:
|
88
|
+
| key | value |
|
89
|
+
| source | ./_bibliography |
|
90
|
+
| bibliography_list_tag | ol |
|
91
|
+
And I have a "_bibliography" directory
|
92
|
+
And I have a file "_bibliography/references.bib":
|
93
|
+
"""
|
94
|
+
@book{ruby,
|
95
|
+
title = {The Ruby Programming Language},
|
96
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
97
|
+
year = {2008},
|
98
|
+
publisher = {O'Reilly Media}
|
99
|
+
}
|
100
|
+
@book{smalltalk,
|
101
|
+
title = {Smalltalk Best Practice Patterns},
|
102
|
+
author = {Kent Beck},
|
103
|
+
year = {1996},
|
104
|
+
publisher = {Prentice Hall}
|
105
|
+
}
|
106
|
+
"""
|
107
|
+
And I have a page "scholar.html":
|
108
|
+
"""
|
109
|
+
---
|
110
|
+
---
|
111
|
+
{% bibliography -f references %}
|
112
|
+
"""
|
113
|
+
And I have a page "scholar-ul.html":
|
114
|
+
"""
|
115
|
+
---
|
116
|
+
---
|
117
|
+
{% bibliography -f references --bibliography_list_tag ul %}
|
118
|
+
"""
|
119
|
+
|
120
|
+
When I run jekyll
|
121
|
+
Then the _site directory should exist
|
122
|
+
And the "_site/scholar.html" file should exist
|
123
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
124
|
+
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
125
|
+
And I should see "<ol class=\"bibliography\">" in "_site/scholar.html"
|
126
|
+
And I should see "</ol>" in "_site/scholar.html"
|
127
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar-ul.html"
|
128
|
+
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar-ul.html"
|
129
|
+
And I should see "<ul class=\"bibliography\">" in "_site/scholar-ul.html"
|
130
|
+
And I should see "</ul>" in "_site/scholar-ul.html"
|
131
|
+
|
132
|
+
@tags @bibliography
|
133
|
+
Scenario: Default bibliography_list_tag: nonconforming html tags :)
|
134
|
+
Given I have a scholar configuration with:
|
135
|
+
| key | value |
|
136
|
+
| source | ./_bibliography |
|
137
|
+
| bibliography_list_tag | ol |
|
138
|
+
And I have a "_bibliography" directory
|
139
|
+
And I have a file "_bibliography/references.bib":
|
140
|
+
"""
|
141
|
+
@book{ruby,
|
142
|
+
title = {The Ruby Programming Language},
|
143
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
144
|
+
year = {2008},
|
145
|
+
publisher = {O'Reilly Media}
|
146
|
+
}
|
147
|
+
@book{smalltalk,
|
148
|
+
title = {Smalltalk Best Practice Patterns},
|
149
|
+
author = {Kent Beck},
|
150
|
+
year = {1996},
|
151
|
+
publisher = {Prentice Hall}
|
152
|
+
}
|
153
|
+
"""
|
154
|
+
And I have a page "scholar.html":
|
155
|
+
"""
|
156
|
+
---
|
157
|
+
---
|
158
|
+
{% bibliography -f references -h ab %}
|
159
|
+
"""
|
160
|
+
And I have a page "scholar-ul.html":
|
161
|
+
"""
|
162
|
+
---
|
163
|
+
---
|
164
|
+
{% bibliography -f references -h cd %}
|
165
|
+
"""
|
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 "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
171
|
+
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
172
|
+
And I should see "<ab class=\"bibliography\">" in "_site/scholar.html"
|
173
|
+
And I should see "</ab>" in "_site/scholar.html"
|
174
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar-ul.html"
|
175
|
+
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar-ul.html"
|
176
|
+
And I should see "<cd class=\"bibliography\">" in "_site/scholar-ul.html"
|
177
|
+
And I should see "</cd>" in "_site/scholar-ul.html"
|
178
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'jekyll/scholar'
|
data/lib/jekyll/scholar.rb
CHANGED
@@ -13,6 +13,7 @@ require 'jekyll/scholar/utilities'
|
|
13
13
|
|
14
14
|
require 'jekyll/scholar/converters/bibtex'
|
15
15
|
require 'jekyll/scholar/tags/bibliography'
|
16
|
+
require 'jekyll/scholar/tags/bibliography_count'
|
16
17
|
require 'jekyll/scholar/tags/bibtex'
|
17
18
|
require 'jekyll/scholar/tags/cite'
|
18
19
|
require 'jekyll/scholar/tags/cite_details'
|
@@ -15,32 +15,10 @@ module Jekyll
|
|
15
15
|
def render(context)
|
16
16
|
set_context_to context
|
17
17
|
|
18
|
-
# Add bibtex files to dependency tree
|
19
|
-
|
20
|
-
bibtex_paths.each do |bibtex_path|
|
21
|
-
site.regenerator.add_dependency(
|
22
|
-
site.in_source_dir(context.registers[:page]["path"]),
|
23
|
-
bibtex_path
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|
18
|
+
# Add bibtex files to dependency tree.
|
19
|
+
update_dependency_tree
|
27
20
|
|
28
|
-
items =
|
29
|
-
|
30
|
-
if cited_only?
|
31
|
-
items = if skip_sort?
|
32
|
-
cited_references.uniq.map do |key|
|
33
|
-
items.detect { |e| e.key == key }
|
34
|
-
end
|
35
|
-
else
|
36
|
-
entries.select do |e|
|
37
|
-
cited_references.include? e.key
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# See #90
|
42
|
-
cited_keys.clear
|
43
|
-
end
|
21
|
+
items = cited_entries
|
44
22
|
|
45
23
|
if group?
|
46
24
|
groups = group(items)
|
@@ -56,7 +34,7 @@ module Jekyll
|
|
56
34
|
def render_groups(groups)
|
57
35
|
def group_renderer(groupsOrItems,keys,order,tags)
|
58
36
|
if keys.count == 0
|
59
|
-
renderer(
|
37
|
+
renderer(true)
|
60
38
|
render_items(groupsOrItems)
|
61
39
|
else
|
62
40
|
groupsOrItems
|
@@ -92,7 +70,7 @@ module Jekyll
|
|
92
70
|
content_tag config['bibliography_item_tag'], reference, config['bibliography_item_attributes']
|
93
71
|
}.join("\n")
|
94
72
|
|
95
|
-
content_tag
|
73
|
+
content_tag bibliography_list_tag, bibliography,
|
96
74
|
{ :class => config['bibliography_class'] }.merge(config['bibliography_list_attributes'])
|
97
75
|
|
98
76
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class Scholar
|
3
|
+
|
4
|
+
class BibliographyCountTag < Liquid::Tag
|
5
|
+
include Scholar::Utilities
|
6
|
+
|
7
|
+
def initialize(tag_name, arguments, tokens)
|
8
|
+
super
|
9
|
+
|
10
|
+
@config = Scholar.defaults.dup
|
11
|
+
|
12
|
+
optparse(arguments)
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(context)
|
16
|
+
set_context_to context
|
17
|
+
|
18
|
+
# Add bibtex files to dependency tree.
|
19
|
+
update_dependency_tree
|
20
|
+
|
21
|
+
cited_entries.size
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Liquid::Template.register_tag('bibliography_count', Jekyll::Scholar::BibliographyCountTag)
|
@@ -30,7 +30,7 @@ module Jekyll
|
|
30
30
|
return if arguments.nil? || arguments.empty?
|
31
31
|
|
32
32
|
parser = OptionParser.new do |opts|
|
33
|
-
|
33
|
+
opts.on('-c', '--cited') do |cited|
|
34
34
|
@cited = true
|
35
35
|
end
|
36
36
|
|
@@ -51,6 +51,10 @@ module Jekyll
|
|
51
51
|
@query = query
|
52
52
|
end
|
53
53
|
|
54
|
+
opts.on('-h', '--bibliography_list_tag TAG') do |tag|
|
55
|
+
@bibliography_list_tag = tag
|
56
|
+
end
|
57
|
+
|
54
58
|
opts.on('-p', '--prefix PREFIX') do |prefix|
|
55
59
|
@prefix = prefix
|
56
60
|
end
|
@@ -96,11 +100,19 @@ module Jekyll
|
|
96
100
|
end
|
97
101
|
end
|
98
102
|
|
99
|
-
argv = arguments.split(/(\B-[
|
103
|
+
argv = arguments.split(/(\B-[cCfhqptTsgGOlLomA]|\B--(?:cited(_in_order)?|bibliography_list_tag|file|query|prefix|text|style|group_(?:by|order)|type_order|template|locator|label|offset|max|suppress_author|))/)
|
100
104
|
|
101
105
|
parser.parse argv.map(&:strip).reject(&:empty?)
|
102
106
|
end
|
103
107
|
|
108
|
+
def bibliography_list_tag
|
109
|
+
if @bibliography_list_tag.nil?
|
110
|
+
config['bibliography_list_tag']
|
111
|
+
else
|
112
|
+
@bibliography_list_tag
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
104
116
|
def locators
|
105
117
|
@locators ||= []
|
106
118
|
end
|
@@ -129,7 +141,8 @@ module Jekyll
|
|
129
141
|
|
130
142
|
def bibtex_paths
|
131
143
|
@bibtex_paths ||= bibtex_files.map { |file|
|
132
|
-
|
144
|
+
interpolated_file = interpolate file
|
145
|
+
extend_path interpolated_file
|
133
146
|
}
|
134
147
|
end
|
135
148
|
|
@@ -711,6 +724,38 @@ module Jekyll
|
|
711
724
|
def styles(style)
|
712
725
|
STYLES[style] ||= load_style(style)
|
713
726
|
end
|
727
|
+
|
728
|
+
def update_dependency_tree
|
729
|
+
# Add bibtex files to dependency tree
|
730
|
+
if context.registers[:page] and context.registers[:page].key? "path"
|
731
|
+
bibtex_paths.each do |bibtex_path|
|
732
|
+
site.regenerator.add_dependency(
|
733
|
+
site.in_source_dir(context.registers[:page]["path"]),
|
734
|
+
bibtex_path
|
735
|
+
)
|
736
|
+
end
|
737
|
+
end
|
738
|
+
end
|
739
|
+
|
740
|
+
def cited_entries
|
741
|
+
items = entries
|
742
|
+
if cited_only?
|
743
|
+
items = if skip_sort?
|
744
|
+
cited_references.uniq.map do |key|
|
745
|
+
items.detect { |e| e.key == key }
|
746
|
+
end
|
747
|
+
else
|
748
|
+
entries.select do |e|
|
749
|
+
cited_references.include? e.key
|
750
|
+
end
|
751
|
+
end
|
752
|
+
|
753
|
+
# See #90
|
754
|
+
cited_keys.clear
|
755
|
+
end
|
756
|
+
|
757
|
+
items
|
758
|
+
end
|
714
759
|
end
|
715
760
|
|
716
761
|
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.11.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:
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -90,6 +90,9 @@ files:
|
|
90
90
|
- README.md
|
91
91
|
- Rakefile
|
92
92
|
- cucumber.yml
|
93
|
+
- features/186.feature
|
94
|
+
- features/191.feature
|
95
|
+
- features/215.feature
|
93
96
|
- features/bibtex.feature
|
94
97
|
- features/citation.feature
|
95
98
|
- features/cite_details.feature
|
@@ -108,6 +111,7 @@ files:
|
|
108
111
|
- features/support/env.rb
|
109
112
|
- features/support/hooks.rb
|
110
113
|
- jekyll-scholar.gemspec
|
114
|
+
- lib/jekyll-scholar.rb
|
111
115
|
- lib/jekyll/scholar.rb
|
112
116
|
- lib/jekyll/scholar/converters/bibtex.rb
|
113
117
|
- lib/jekyll/scholar/defaults.rb
|
@@ -116,6 +120,7 @@ files:
|
|
116
120
|
- lib/jekyll/scholar/plugins/smallcaps.rb
|
117
121
|
- lib/jekyll/scholar/plugins/superscript.rb
|
118
122
|
- lib/jekyll/scholar/tags/bibliography.rb
|
123
|
+
- lib/jekyll/scholar/tags/bibliography_count.rb
|
119
124
|
- lib/jekyll/scholar/tags/bibtex.rb
|
120
125
|
- lib/jekyll/scholar/tags/cite.rb
|
121
126
|
- lib/jekyll/scholar/tags/cite_details.rb
|
@@ -143,11 +148,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
148
|
version: 1.3.6
|
144
149
|
requirements: []
|
145
150
|
rubyforge_project: jekyll-scholar
|
146
|
-
rubygems_version: 2.6.
|
151
|
+
rubygems_version: 2.6.13
|
147
152
|
signing_key:
|
148
153
|
specification_version: 4
|
149
154
|
summary: Jekyll extensions for the academic blogger.
|
150
155
|
test_files:
|
156
|
+
- features/186.feature
|
157
|
+
- features/191.feature
|
158
|
+
- features/215.feature
|
151
159
|
- features/bibtex.feature
|
152
160
|
- features/citation.feature
|
153
161
|
- features/cite_details.feature
|