jekyll-scholar 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +12 -0
- data/Gemfile +15 -3
- data/README.md +44 -11
- data/Rakefile +23 -0
- data/cucumber.yml +1 -0
- data/features/bibtex.feature +164 -136
- data/features/citation.feature +98 -98
- data/features/cite_details.feature +48 -48
- data/features/details.feature +132 -67
- data/features/filter.feature +32 -32
- data/features/reference.feature +31 -2
- data/features/sorting.feature +57 -57
- data/features/support/env.rb +5 -1
- data/jekyll-scholar.gemspec +1 -11
- data/lib/jekyll/scholar/defaults.rb +23 -16
- data/lib/jekyll/scholar/generators/details.rb +3 -1
- data/lib/jekyll/scholar/tags/bibliography.rb +4 -4
- data/lib/jekyll/scholar/utilities.rb +37 -7
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +7 -130
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjIwNWM2NmQ3MWVlMDdlMGU4MTBjMjUyYmZiNmNhZjdlMjEzYTJiOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTg5Y2YxZDMyN2Y3N2Q2MTU5OWQwZWM0MWI3OGU1MWYwODg0OWVkZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmI1YTYzMmFjYzJkMDVhOTJmMTAyOWFmMmI4YzY1NTNiNmU0NGI4NjQ5OGI2
|
10
|
+
ODM4NDFlNWIwNTBhZmVhYzkxOWQ1ZDk5MzU4ZWVmMjVmZDZlMTQ1YTYwM2M0
|
11
|
+
NzdkOTFjYjc5MGM3N2Y5NzNlOWE1ZmYzMTRhNmVmZjMzZWQxZjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YThmN2Q5ZTY0MDc2MzM1NTM5Y2E4NjlmZjdjNDFlODY4NDIzYWJkYTEyZTk3
|
14
|
+
MDA1NGQ1OGY3ZjAzNDlmOTgzNjk2ZjAwMmEyZmJiZDJhOWY3MWQ1ZTkxNzhk
|
15
|
+
MDZkYWUwOTliNmU1ZTU0ZjM1ODg5YjlhMmQ2NmFhMDI4MzRmOGQ=
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
gem 'unicode_utils'
|
5
|
-
|
6
4
|
group 'development' do
|
7
|
-
|
5
|
+
gem 'rake'
|
6
|
+
gem 'redgreen', '~> 1.2'
|
7
|
+
gem 'shoulda', '~> 3.3.2'
|
8
|
+
gem 'rr', '~> 1.0'
|
9
|
+
gem 'cucumber', '~> 1.2.1'
|
10
|
+
gem 'RedCloth', '~> 4.2'
|
11
|
+
gem 'rdiscount', '~> 1.6'
|
12
|
+
gem 'redcarpet', '~> 2.2.2'
|
13
|
+
gem 'launchy', '~> 2.1.2'
|
14
|
+
|
15
|
+
gem 'unicode_utils'
|
16
|
+
end
|
17
|
+
|
18
|
+
group 'debug' do
|
19
|
+
gem 'debugger'
|
8
20
|
end
|
data/README.md
CHANGED
@@ -9,13 +9,14 @@ and gives your blog posts citation super-powers.
|
|
9
9
|
For additional features you may also want to take a look at
|
10
10
|
[jekyll-scholar-extras](https://github.com/hdpatel/jekyll-scholar-extras).
|
11
11
|
|
12
|
+
[![Build Status](https://travis-ci.org/inukshuk/jekyll-scholar.png?branch=master)](https://travis-ci.org/inukshuk/jekyll-scholar)
|
13
|
+
|
12
14
|
|
13
15
|
Installation
|
14
16
|
------------
|
15
17
|
|
16
18
|
$ [sudo] gem install jekyll-scholar
|
17
19
|
|
18
|
-
|
19
20
|
Usage
|
20
21
|
-----
|
21
22
|
|
@@ -38,7 +39,8 @@ default configuration is as follows:
|
|
38
39
|
|
39
40
|
source: ./_bibliography
|
40
41
|
bibliography: references.bib
|
41
|
-
|
42
|
+
bibliography_template: %{reference}
|
43
|
+
|
42
44
|
details_dir: bibliography
|
43
45
|
details_layout: bibtex.html
|
44
46
|
details_link: Details
|
@@ -140,6 +142,26 @@ For more details about filters, see the corresponding section below or
|
|
140
142
|
consult the [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby)
|
141
143
|
documentation.
|
142
144
|
|
145
|
+
### Bibliography Template
|
146
|
+
|
147
|
+
Your bibliography is always rendered as an ordered list. Additionally,
|
148
|
+
each reference is wrapped in an HTML tag (`span` by default but you can
|
149
|
+
change this using the `reference_tagname` setting) with the cite key
|
150
|
+
as id. The reference string itself is governed by the rules in your
|
151
|
+
CSL style but you can also customize the main template a little bit.
|
152
|
+
By default, the template is `%{reference}` – this renders only the
|
153
|
+
reference tag. The template uses Ruby string interpolation and, in
|
154
|
+
addition to the reference, exposes the cite-key (as `key`), the
|
155
|
+
entry's `type` and the `index` in the bibliography. Thus, you could
|
156
|
+
customize the template in your configuration as follows:
|
157
|
+
|
158
|
+
scholar:
|
159
|
+
bibliography_template: <abbr>[%{key}]</abbr>%{reference}
|
160
|
+
|
161
|
+
This would be processed into something like:
|
162
|
+
|
163
|
+
<li><abbr>[ruby]</abbr><span id="ruby">Matsumoto, Y. (2008). <i>The Ruby Programming Language</i>. O’Reilly Media.</span></li>
|
164
|
+
|
143
165
|
|
144
166
|
### Citations
|
145
167
|
|
@@ -226,14 +248,14 @@ a specific page. As an example, the tag
|
|
226
248
|
will attempt to read the key `ruby` from file `/home/foo/bar.bib`. It will not
|
227
249
|
fallback to the default BibTeX file.
|
228
250
|
|
229
|
-
####
|
251
|
+
#### Multiple bibliographies within one document (like [multibib.sty](http://www.ctan.org/pkg/multibib))
|
230
252
|
|
231
253
|
When you have multiple `{% bibliography %}` sections in one file,
|
232
|
-
Jekyll-Scholar will generate
|
254
|
+
Jekyll-Scholar will generate several lists containing the same
|
233
255
|
publications that have the same `id` attributes. As a result, when you
|
234
256
|
cite a reference the link to an `id` attribute cannot be resolved
|
235
257
|
uniquely. Your browser will always take you take you to the first
|
236
|
-
|
258
|
+
occurrence of the `id`. Moreover, valid HTML requires unique `id`
|
237
259
|
attributes. This scenario may happen, for example, if you cite the
|
238
260
|
same reference in different blog posts, and all of these posts are
|
239
261
|
shown in one html document.
|
@@ -275,9 +297,9 @@ For the second blog post you would cite as follows:
|
|
275
297
|
|
276
298
|
{% bibliography --cited --prefix post2 %}
|
277
299
|
|
278
|
-
Even though both posts cite rabinowitz, both citations will be
|
279
|
-
assigned unique identifiers linking to the respective
|
280
|
-
section
|
300
|
+
Even though both posts cite 'rabinowitz', both citations will be
|
301
|
+
assigned unique identifiers linking to the respective references
|
302
|
+
section, although both posts will be rendered into a single HTML
|
281
303
|
document.
|
282
304
|
|
283
305
|
|
@@ -339,8 +361,9 @@ configuration option. For example:
|
|
339
361
|
query: "@*[url]" #=> includes all entries with a url field
|
340
362
|
query: "@*[status!=review]" #=> includes all entries whose status field is not set to 'review'
|
341
363
|
query: "@book[year <= 1900 && author ^= Poe]" #=> Books published before 1900 where the author matches /Poe/
|
364
|
+
query: "!@book" #=> includes all entries with a type other than book
|
342
365
|
|
343
|
-
Please note that some of these queries require
|
366
|
+
Please note that some of these queries require BibTeX-Ruby 2.3.0 or
|
344
367
|
later versions. You can also overwrite the configuration's query parameter
|
345
368
|
in each bibliography tag individually as described above.
|
346
369
|
|
@@ -356,16 +379,26 @@ You can check out a copy of the latest code using Git:
|
|
356
379
|
To use this lasted version instead of the one provide by RubyGems,
|
357
380
|
just add the line
|
358
381
|
|
359
|
-
|
382
|
+
$:.unshift '/full/path/to/the/repository/lib'
|
360
383
|
|
361
384
|
to your `_plugins/ext.rb` before requiring 'jekyll/scholar', where
|
362
|
-
`/full/path/to/the/repository` is
|
385
|
+
`/full/path/to/the/repository` is the path to your local version
|
386
|
+
of Jekyll-Scholar.
|
387
|
+
|
388
|
+
When contributing to Jekyll-Scholar, please make sure to install
|
389
|
+
all dependencies and run the cucumber features:
|
390
|
+
|
391
|
+
$ bundle install
|
392
|
+
$ rake
|
363
393
|
|
364
394
|
If you've found a bug or have a question, please open an issue on the
|
365
395
|
[Jekyll-Scholar issue tracker](http://github.com/inukshuk/jekyll-scholar/issues).
|
366
396
|
Or, for extra credit, clone the Jekyll-Scholar repository, write a failing
|
367
397
|
example, fix the bug and submit a pull request.
|
368
398
|
|
399
|
+
Additionally, if we merged at least one of your pull request you will get
|
400
|
+
write permissions to the repository if you want them.
|
401
|
+
|
369
402
|
License
|
370
403
|
-------
|
371
404
|
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
begin
|
3
|
+
Bundler.setup(:default, :development)
|
4
|
+
rescue Bundler::BundlerError => e
|
5
|
+
$stderr.puts e.message
|
6
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
+
exit e.status_code
|
8
|
+
end
|
9
|
+
require 'rake'
|
10
|
+
|
11
|
+
require 'jekyll/scholar/version'
|
12
|
+
|
13
|
+
require 'cucumber/rake/task'
|
14
|
+
Cucumber::Rake::Task.new(:features)
|
15
|
+
|
16
|
+
task :default => [:features]
|
17
|
+
|
18
|
+
task :release do |t|
|
19
|
+
system "gem build jekyll-scholar.gemspec"
|
20
|
+
system "git tag #{Jekyll::Scholar::VERSION}"
|
21
|
+
system "git push --tags"
|
22
|
+
system "gem push jekyll-scholar-#{Jekyll::Scholar::VERSION}.gem"
|
23
|
+
end
|
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --require features --color
|
data/features/bibtex.feature
CHANGED
@@ -4,156 +4,184 @@ Feature: BibTeX
|
|
4
4
|
In order to share my awesome references with my peers
|
5
5
|
|
6
6
|
@converters
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
7
|
+
Scenario: Simple Bibliography
|
8
|
+
Given I have a scholar configuration with:
|
9
|
+
| key | value |
|
10
|
+
| style | apa |
|
11
|
+
And I have a page "references.bib":
|
12
|
+
"""
|
13
|
+
---
|
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
|
+
When I run jekyll
|
23
|
+
Then the _site directory should exist
|
24
|
+
And the "_site/references.html" file should exist
|
25
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/references.html"
|
26
26
|
|
27
27
|
@converters
|
28
|
-
|
28
|
+
Scenario: Markdown Formatted Bibliography
|
29
29
|
Given I have a scholar configuration with:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
30
|
+
| key | value |
|
31
|
+
| style | apa |
|
32
|
+
And I have a page "references.bib":
|
33
|
+
"""
|
34
|
+
---
|
35
|
+
---
|
36
|
+
References
|
37
|
+
==========
|
38
|
+
|
39
|
+
@book{ruby,
|
40
|
+
title = {The Ruby Programming Language},
|
41
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
42
|
+
year = {2008},
|
43
|
+
publisher = {O'Reilly Media}
|
44
|
+
}
|
45
|
+
"""
|
46
|
+
When I run jekyll
|
47
|
+
Then I should see "<h1[^>]*>References</h1>" in "_site/references.html"
|
48
48
|
|
49
49
|
@latex
|
50
|
-
|
50
|
+
Scenario: Simple Bibliography with LaTeX directives
|
51
51
|
Given I have a scholar configuration with:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
52
|
+
| key | value |
|
53
|
+
| style | apa |
|
54
|
+
And I have a page "references.bib":
|
55
|
+
"""
|
56
|
+
---
|
57
|
+
---
|
58
|
+
@misc{umlaut,
|
59
|
+
title = {Look, an umlaut: \"u!},
|
60
|
+
}
|
61
|
+
"""
|
62
|
+
When I run jekyll
|
63
|
+
Then the _site directory should exist
|
64
|
+
And the "_site/references.html" file should exist
|
65
|
+
And I should see "Look, an umlaut: ü!" in "_site/references.html"
|
66
66
|
|
67
67
|
@tags
|
68
|
-
|
68
|
+
Scenario: Simple Bibliography Loaded From Default Directory
|
69
|
+
Given I have a scholar configuration with:
|
70
|
+
| key | value |
|
71
|
+
| source | ./_bibliography |
|
72
|
+
And I have a "_bibliography" directory
|
73
|
+
And I have a file "_bibliography/references.bib":
|
74
|
+
"""
|
75
|
+
@book{ruby,
|
76
|
+
title = {The Ruby Programming Language},
|
77
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
78
|
+
year = {2008},
|
79
|
+
publisher = {O'Reilly Media}
|
80
|
+
}
|
81
|
+
"""
|
82
|
+
And I have a page "scholar.html":
|
83
|
+
"""
|
84
|
+
---
|
85
|
+
---
|
86
|
+
{% bibliography -f references %}
|
87
|
+
"""
|
88
|
+
When I run jekyll
|
89
|
+
Then the _site directory should exist
|
90
|
+
And the "_site/scholar.html" file should exist
|
91
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
92
|
+
|
93
|
+
@tags @bibliography @config
|
94
|
+
Scenario: Simple Bibliography With Custom Template
|
69
95
|
Given I have a scholar configuration with:
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
96
|
+
| key | value |
|
97
|
+
| source | ./_bibliography |
|
98
|
+
| bibliography_template | <abbr>%{index} [%{key}]</abbr>%{reference} |
|
99
|
+
And I have a "_bibliography" directory
|
100
|
+
And I have a file "_bibliography/references.bib":
|
101
|
+
"""
|
102
|
+
@book{ruby,
|
103
|
+
title = {The Ruby Programming Language},
|
104
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
105
|
+
year = {2008},
|
106
|
+
publisher = {O'Reilly Media}
|
107
|
+
}
|
108
|
+
"""
|
109
|
+
And I have a page "scholar.html":
|
110
|
+
"""
|
111
|
+
---
|
112
|
+
---
|
113
|
+
{% bibliography -f references %}
|
114
|
+
"""
|
115
|
+
When I run jekyll
|
116
|
+
Then the _site directory should exist
|
117
|
+
And the "_site/scholar.html" file should exist
|
118
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
119
|
+
And I should see "<abbr>1 \[ruby\]</abbr><span" in "_site/scholar.html"
|
92
120
|
|
93
121
|
@tags @filter
|
94
|
-
|
122
|
+
Scenario: Filtered Bibliography Loaded From Default Directory
|
95
123
|
Given I have a scholar configuration with:
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
124
|
+
| key | value |
|
125
|
+
| source | ./_bibliography |
|
126
|
+
And I have a "_bibliography" directory
|
127
|
+
And I have a file "_bibliography/references.bib":
|
128
|
+
"""
|
129
|
+
@book{ruby,
|
130
|
+
title = {The Ruby Programming Language},
|
131
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
132
|
+
year = {2008},
|
133
|
+
publisher = {O'Reilly Media}
|
134
|
+
},
|
135
|
+
@book{smalltalk,
|
136
|
+
title = {Smalltalk Best Practice Patterns},
|
137
|
+
author = {Kent Beck},
|
138
|
+
year = {1996},
|
139
|
+
publisher = {Prentice Hall}
|
140
|
+
}
|
113
141
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
142
|
+
"""
|
143
|
+
And I have a page "scholar.html":
|
144
|
+
"""
|
145
|
+
---
|
146
|
+
---
|
147
|
+
{% bibliography -f references --query @book[year <= 2000] %}
|
148
|
+
"""
|
149
|
+
When I run jekyll
|
150
|
+
Then the _site directory should exist
|
151
|
+
And the "_site/scholar.html" file should exist
|
152
|
+
And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
|
153
|
+
And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
|
126
154
|
|
127
155
|
@tags @bibliography @prefix
|
128
|
-
|
156
|
+
Scenario: A Prefixed Bibliography
|
129
157
|
Given I have a scholar configuration with:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
158
|
+
| key | value |
|
159
|
+
| source | ./_bibliography |
|
160
|
+
And I have a "_bibliography" directory
|
161
|
+
And I have a file "_bibliography/references.bib":
|
162
|
+
"""
|
163
|
+
@book{ruby,
|
164
|
+
title = {The Ruby Programming Language},
|
165
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
166
|
+
year = {2008},
|
167
|
+
publisher = {O'Reilly Media}
|
168
|
+
},
|
169
|
+
@book{smalltalk,
|
170
|
+
title = {Smalltalk Best Practice Patterns},
|
171
|
+
author = {Kent Beck},
|
172
|
+
year = {1996},
|
173
|
+
publisher = {Prentice Hall}
|
174
|
+
}
|
147
175
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
176
|
+
"""
|
177
|
+
And I have a page "scholar.html":
|
178
|
+
"""
|
179
|
+
---
|
180
|
+
---
|
181
|
+
{% bibliography --file references --prefix a -q @book[year <= 2000] %}
|
182
|
+
"""
|
183
|
+
When I run jekyll
|
184
|
+
Then the _site directory should exist
|
185
|
+
And the "_site/scholar.html" file should exist
|
186
|
+
And I should not see "ruby" in "_site/scholar.html"
|
187
|
+
And I should see "id=\"a-smalltalk\"" in "_site/scholar.html"
|