jekyll-scholar 1.2.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/Gemfile +6 -3
- data/README.md +44 -6
- data/features/bibtex.feature +4 -4
- data/features/details.feature +2 -2
- data/features/repository.feature +48 -0
- data/jekyll-scholar.gemspec +2 -2
- data/lib/jekyll/scholar/defaults.rb +2 -1
- data/lib/jekyll/scholar/generators/details.rb +3 -20
- data/lib/jekyll/scholar/tags/bibliography.rb +1 -1
- data/lib/jekyll/scholar/utilities.rb +79 -9
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 082fd7a25a1d8bec380e5311248c00a86680f5bc
|
4
|
+
data.tar.gz: 34123cf9d4f87b7fad1d8d2312fa727df7ba3cd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d977833e021bf6d06e42ab6eef3650c07eab7fd1ffdcdaf02595df83956a5cc238ca743f8847f65fef3082f0dec9f14efa4999832599835ca41c19c26ca21f
|
7
|
+
data.tar.gz: 503c8db545f09233ea25239705778d3c724dc4180c21201672e574b00c0b5b40d7563d8ce2cde705204c469811dd0437dafe437add161fdabd137bbf80071cde
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -12,9 +12,12 @@ group 'development' do
|
|
12
12
|
gem 'redcarpet', '~> 2.2.2'
|
13
13
|
gem 'launchy', '~> 2.1.2'
|
14
14
|
|
15
|
-
gem 'unicode_utils'
|
15
|
+
gem 'unicode_utils'
|
16
16
|
end
|
17
17
|
|
18
|
-
group
|
19
|
-
gem '
|
18
|
+
group :debug do
|
19
|
+
gem 'ruby-debug', :require => false, :platform => :jruby
|
20
|
+
gem 'debugger', '~>1.6', :require => false, :platform => :mri
|
21
|
+
gem 'rubinius-compiler', '~>2.0', :require => false, :platform => :rbx
|
22
|
+
gem 'rubinius-debugger', '~>2.0', :require => false, :platform => :rbx
|
20
23
|
end
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ default configuration is as follows:
|
|
39
39
|
|
40
40
|
source: ./_bibliography
|
41
41
|
bibliography: references.bib
|
42
|
-
bibliography_template: "
|
42
|
+
bibliography_template: "{{reference}}"
|
43
43
|
|
44
44
|
replace_strings: true
|
45
45
|
|
@@ -60,7 +60,8 @@ your references (this typically applies to localized terms, e.g., 'Eds.' for
|
|
60
60
|
editors in English).
|
61
61
|
|
62
62
|
The `source` option indicates where your bibliographies are stored;
|
63
|
-
`bibliography` is the name of your default bibliography.
|
63
|
+
`bibliography` is the name of your default bibliography. For best results,
|
64
|
+
please ensure that your Bibliography is encoded as ASCII or UTF-8.
|
64
65
|
|
65
66
|
|
66
67
|
### Bibliographies
|
@@ -151,19 +152,46 @@ each reference is wrapped in an HTML tag (`span` by default but you can
|
|
151
152
|
change this using the `reference_tagname` setting) with the cite key
|
152
153
|
as id. The reference string itself is governed by the rules in your
|
153
154
|
CSL style but you can also customize the main template a little bit.
|
154
|
-
By default, the template is
|
155
|
-
reference tag. The template uses
|
155
|
+
By default, the template is `{{reference}}` – this renders only the
|
156
|
+
reference tag. The template uses Liquid to render and, in
|
156
157
|
addition to the reference, exposes the cite-key (as `key`), the
|
157
|
-
entry's `type
|
158
|
+
entry's `type`, the `index` in the bibliography, and the link to
|
159
|
+
file repository as `link`. Thus, you could
|
158
160
|
customize the template in your configuration as follows:
|
159
161
|
|
160
162
|
scholar:
|
161
|
-
bibliography_template: <abbr>[
|
163
|
+
bibliography_template: <abbr>[{{key}}]</abbr>{{reference}}
|
162
164
|
|
163
165
|
This would be processed into something like:
|
164
166
|
|
165
167
|
<li><abbr>[ruby]</abbr><span id="ruby">Matsumoto, Y. (2008). <i>The Ruby Programming Language</i>. O’Reilly Media.</span></li>
|
166
168
|
|
169
|
+
If you have more complex requirements, it quickly becomes tedious to
|
170
|
+
have the template inside the configuration; for this reason, you can
|
171
|
+
also put the bibliography template into your layouts directory. Jekyll-Scholar
|
172
|
+
will load this template if the option set in your configuration matches
|
173
|
+
an existing layout (without the file extension). That is to say, if you set:
|
174
|
+
|
175
|
+
scholar:
|
176
|
+
bibliography_template: bib
|
177
|
+
|
178
|
+
And there is a file `_layouts/bib.html` (or with another extension) the
|
179
|
+
contents of this file will be used as the template. Please note that it is
|
180
|
+
important for this file to contain the YAML front matter! For example, this
|
181
|
+
would be a more complex template file:
|
182
|
+
|
183
|
+
---
|
184
|
+
---
|
185
|
+
{{ reference }}
|
186
|
+
|
187
|
+
{% if entry.abstract %}
|
188
|
+
<p>{{ entry.abstract %}</p>
|
189
|
+
{% endif %}
|
190
|
+
|
191
|
+
<pre>{{ entry.bibtex %}</pre>
|
192
|
+
|
193
|
+
You can also override the default bibliography template, by passing the
|
194
|
+
`--template` or `-T` option parameter to the bibliography tag.
|
167
195
|
|
168
196
|
### Citations
|
169
197
|
|
@@ -305,6 +333,16 @@ section, although both posts will be rendered into a single HTML
|
|
305
333
|
document.
|
306
334
|
|
307
335
|
|
336
|
+
### File Repositories
|
337
|
+
|
338
|
+
File repository support was added to Jekyll-Scholar starting at version
|
339
|
+
4.0. Currently, if you have a folder in your site that contains PDF or
|
340
|
+
Postscript files of your papers, you can use the configuration option
|
341
|
+
`repository` to indicate this directory. When generating bibliographies,
|
342
|
+
Jekyll-Scholar will look in that folder to see if it contains a filename
|
343
|
+
matching each entry's BibTeX key: if it does, the path to that file
|
344
|
+
will be exposed to the bibliography template.
|
345
|
+
|
308
346
|
### Detail Pages
|
309
347
|
|
310
348
|
If your layouts directory contains a layout file for bibliography details
|
data/features/bibtex.feature
CHANGED
@@ -35,7 +35,7 @@ Feature: BibTeX
|
|
35
35
|
---
|
36
36
|
References
|
37
37
|
==========
|
38
|
-
|
38
|
+
|
39
39
|
@book{ruby,
|
40
40
|
title = {The Ruby Programming Language},
|
41
41
|
author = {Flanagan, David and Matsumoto, Yukihiro},
|
@@ -93,9 +93,9 @@ Feature: BibTeX
|
|
93
93
|
@tags @bibliography @config
|
94
94
|
Scenario: Simple Bibliography With Custom Template
|
95
95
|
Given I have a scholar configuration with:
|
96
|
-
| key | value
|
97
|
-
| source | ./_bibliography
|
98
|
-
| bibliography_template | <abbr
|
96
|
+
| key | value |
|
97
|
+
| source | ./_bibliography |
|
98
|
+
| bibliography_template | <abbr>{{index}} [{{key}}]</abbr>{{reference}} |
|
99
99
|
And I have a "_bibliography" directory
|
100
100
|
And I have a file "_bibliography/references.bib":
|
101
101
|
"""
|
data/features/details.feature
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Details
|
2
2
|
As a scholar who likes to blog
|
3
3
|
I want to publish my BibTeX bibliography on my blog
|
4
4
|
And I want Jekyll to generate detail pages for all the entries in my bibliography
|
5
|
-
|
5
|
+
|
6
6
|
@generators
|
7
7
|
Scenario: A bibliography with a single entry
|
8
8
|
Given I have a scholar configuration with:
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Feature: PDF Repository
|
2
|
+
As a scholar who likes to blog
|
3
|
+
I want to publish my BibTeX bibliography on my blog
|
4
|
+
And I want Jekyll to generate links to PDFs of my references automatically
|
5
|
+
|
6
|
+
@repository
|
7
|
+
Scenario: A bibliography with a single entry and a repository
|
8
|
+
Given I have a scholar configuration with:
|
9
|
+
| key | value |
|
10
|
+
| source | ./_bibliography |
|
11
|
+
| repository | papers |
|
12
|
+
| bibliography_template | bibliography |
|
13
|
+
And I have a "_bibliography" directory
|
14
|
+
And I have a file "_bibliography/references.bib":
|
15
|
+
"""
|
16
|
+
@book{ruby,
|
17
|
+
title = {The Ruby Programming Language},
|
18
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
19
|
+
year = {2008},
|
20
|
+
publisher = {O'Reilly Media}
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
And I have a "papers" directory
|
24
|
+
And I have a file "papers/ruby.pdf":
|
25
|
+
"""
|
26
|
+
The PDF
|
27
|
+
"""
|
28
|
+
And I have a "_layouts" directory
|
29
|
+
And I have a file "_layouts/bibliography.html":
|
30
|
+
"""
|
31
|
+
---
|
32
|
+
---
|
33
|
+
{{ reference }} Link: {{ link }}
|
34
|
+
"""
|
35
|
+
And I have a page "scholar.html":
|
36
|
+
"""
|
37
|
+
---
|
38
|
+
---
|
39
|
+
{% bibliography %}
|
40
|
+
"""
|
41
|
+
When I run jekyll
|
42
|
+
Then the _site directory should exist
|
43
|
+
And the "_site/papers/ruby.pdf" file should exist
|
44
|
+
And I should see "The Ruby Programming Language" in "_site/scholar.html"
|
45
|
+
And I should see "Link: /papers/ruby.pdf" in "_site/scholar.html"
|
46
|
+
|
47
|
+
|
48
|
+
|
data/jekyll-scholar.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
formats your BibTeX bibliographies for the web using CSL citation styles
|
20
20
|
and generally gives your blog posts citation super-powers.'
|
21
21
|
}.gsub(/\s+/, ' ')
|
22
|
-
|
22
|
+
|
23
23
|
s.date = Time.now
|
24
24
|
|
25
25
|
s.required_rubygems_version = '>= 1.3.6'
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
34
34
|
s.executables = []
|
35
35
|
s.require_path = 'lib'
|
36
|
-
|
36
|
+
|
37
37
|
end
|
38
38
|
|
39
39
|
# vim: syntax=ruby
|
@@ -9,6 +9,7 @@ module Jekyll
|
|
9
9
|
|
10
10
|
'source' => './_bibliography',
|
11
11
|
'bibliography' => 'references.bib',
|
12
|
+
'repository' => nil,
|
12
13
|
|
13
14
|
'bibtex_options' => { :strip => false },
|
14
15
|
'bibtex_filters' => [ :latex ],
|
@@ -20,7 +21,7 @@ module Jekyll
|
|
20
21
|
'details_link' => 'Details',
|
21
22
|
|
22
23
|
'bibliography_class' => 'bibliography',
|
23
|
-
'bibliography_template' => '
|
24
|
+
'bibliography_template' => '{{reference}}',
|
24
25
|
|
25
26
|
'reference_tagname' => 'span',
|
26
27
|
'missing_reference' => '(missing reference)',
|
@@ -14,31 +14,14 @@ module Jekyll
|
|
14
14
|
process(@name)
|
15
15
|
read_yaml(File.join(base, '_layouts'), config['details_layout'])
|
16
16
|
|
17
|
-
liquidify(entry)
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def liquidify(entry)
|
23
|
-
data['entry'] = {}
|
24
|
-
|
25
|
-
data['entry']['key'] = entry.key
|
26
|
-
data['entry']['type'] = entry.type
|
27
|
-
|
28
|
-
data['entry']['bibtex'] = entry.to_s
|
29
|
-
|
30
|
-
entry.fields.each do |key, value|
|
31
|
-
value = value.convert(*bibtex_filters) unless bibtex_filters.empty?
|
32
|
-
data['entry'][key.to_s] = value.to_s
|
33
|
-
end
|
34
|
-
|
17
|
+
data['entry'] = liquidify(entry)
|
35
18
|
end
|
36
19
|
|
37
20
|
end
|
38
21
|
|
39
22
|
class DetailsGenerator < Generator
|
40
23
|
include Scholar::Utilities
|
41
|
-
|
24
|
+
|
42
25
|
safe true
|
43
26
|
priority :high
|
44
27
|
|
@@ -63,4 +46,4 @@ module Jekyll
|
|
63
46
|
|
64
47
|
|
65
48
|
end
|
66
|
-
end
|
49
|
+
end
|
@@ -35,10 +35,14 @@ module Jekyll
|
|
35
35
|
|
36
36
|
opts.on('-s', '--style STYLE') do |style|
|
37
37
|
@style = style
|
38
|
-
end
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.on('-T', '--template TEMPLATE') do |template|
|
41
|
+
@bibliography_template = template
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
|
-
argv = arguments.split(/(\B-[
|
45
|
+
argv = arguments.split(/(\B-[cfqptTs]|\B--(?:cited|file|query|prefix|text|style|template|))/)
|
42
46
|
|
43
47
|
parser.parse argv.map(&:strip).reject(&:empty?)
|
44
48
|
end
|
@@ -75,6 +79,26 @@ module Jekyll
|
|
75
79
|
b
|
76
80
|
end
|
77
81
|
|
82
|
+
def repository?
|
83
|
+
!config['repository'].nil? && !config['repository'].empty?
|
84
|
+
end
|
85
|
+
|
86
|
+
def repository
|
87
|
+
@repository ||= load_repository
|
88
|
+
end
|
89
|
+
|
90
|
+
def load_repository
|
91
|
+
return {} unless repository?
|
92
|
+
|
93
|
+
Hash[Dir[File.join(repository_path, '**/*.{pdf,ps}')].map { |path|
|
94
|
+
[File.basename(path).sub(/\.(pdf|ps)$/, ''), path]
|
95
|
+
}]
|
96
|
+
end
|
97
|
+
|
98
|
+
def repository_path
|
99
|
+
config['repository']
|
100
|
+
end
|
101
|
+
|
78
102
|
def replace_strings?
|
79
103
|
config['replace_strings']
|
80
104
|
end
|
@@ -120,18 +144,57 @@ module Jekyll
|
|
120
144
|
end
|
121
145
|
|
122
146
|
def bibliography_template
|
123
|
-
config['bibliography_template']
|
147
|
+
@bibliography_template || config['bibliography_template']
|
148
|
+
end
|
149
|
+
|
150
|
+
def liquid_template
|
151
|
+
return @liquid_template if @liquid_template
|
152
|
+
|
153
|
+
tmp = bibliography_template
|
154
|
+
|
155
|
+
case
|
156
|
+
when tmp.nil?, tmp.empty?
|
157
|
+
tmp = '{{reference}}'
|
158
|
+
when site.layouts.key?(tmp)
|
159
|
+
tmp = site.layouts[tmp].content
|
160
|
+
end
|
161
|
+
|
162
|
+
@liquid_template = Liquid::Template.parse(tmp)
|
124
163
|
end
|
125
164
|
|
126
165
|
def bibliography_tag(entry, index)
|
127
166
|
return missing_reference unless entry
|
128
167
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
168
|
+
liquid_template.render({
|
169
|
+
'entry' => liquidify(entry),
|
170
|
+
'reference' => reference_tag(entry),
|
171
|
+
'key' => entry.key,
|
172
|
+
'type' => entry.type,
|
173
|
+
'link' => repository_link_for(entry),
|
174
|
+
'index' => index
|
175
|
+
})
|
176
|
+
end
|
177
|
+
|
178
|
+
def liquidify(entry)
|
179
|
+
e = {}
|
180
|
+
|
181
|
+
e['key'] = entry.key
|
182
|
+
e['type'] = entry.type
|
183
|
+
|
184
|
+
if entry.field?(:abstract)
|
185
|
+
tmp = entry.dup
|
186
|
+
tmp.delete :abstract
|
187
|
+
e['bibtex'] = tmp.to_s
|
188
|
+
else
|
189
|
+
e['bibtex'] = entry.to_s
|
190
|
+
end
|
191
|
+
|
192
|
+
entry.fields.each do |key, value|
|
193
|
+
value = value.convert(*bibtex_filters) unless bibtex_filters.empty?
|
194
|
+
e[key.to_s] = value.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
e
|
135
198
|
end
|
136
199
|
|
137
200
|
def generate_details?
|
@@ -146,6 +209,13 @@ module Jekyll
|
|
146
209
|
[name, 'html'].join('.')
|
147
210
|
end
|
148
211
|
|
212
|
+
def repository_link_for(entry, base = base_url)
|
213
|
+
url = repository[entry.key]
|
214
|
+
return unless url
|
215
|
+
|
216
|
+
File.join(base, url)
|
217
|
+
end
|
218
|
+
|
149
219
|
def details_link_for(entry, base = base_url)
|
150
220
|
File.join(base, details_path, details_file_for(entry))
|
151
221
|
end
|
metadata
CHANGED
@@ -1,68 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-scholar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.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: 2014-01-
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: citeproc-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.0.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.0.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bibtex-ruby
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.3'
|
55
|
-
description:
|
55
|
+
description: " Jekyll-Scholar is for all the academic bloggers out there. It is a
|
56
56
|
set of extensions for Jekyll the awesome, blog aware, static site generator; it
|
57
57
|
formats your BibTeX bibliographies for the web using CSL citation styles and generally
|
58
|
-
gives your blog posts citation super-powers.'
|
58
|
+
gives your blog posts citation super-powers.' "
|
59
59
|
email: http://sylvester.keil.or.at
|
60
60
|
executables: []
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- .gitignore
|
65
|
-
- .travis.yml
|
64
|
+
- ".gitignore"
|
65
|
+
- ".travis.yml"
|
66
66
|
- Gemfile
|
67
67
|
- LICENSE
|
68
68
|
- README.md
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- features/details.feature
|
75
75
|
- features/filter.feature
|
76
76
|
- features/reference.feature
|
77
|
+
- features/repository.feature
|
77
78
|
- features/sorting.feature
|
78
79
|
- features/step_definitions/jekyll_steps.rb
|
79
80
|
- features/step_definitions/scholar_steps.rb
|
@@ -100,17 +101,17 @@ require_paths:
|
|
100
101
|
- lib
|
101
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
103
|
requirements:
|
103
|
-
- -
|
104
|
+
- - ">="
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: '0'
|
106
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
|
-
- -
|
109
|
+
- - ">="
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: 1.3.6
|
111
112
|
requirements: []
|
112
113
|
rubyforge_project: jekyll-scholar
|
113
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.2.1
|
114
115
|
signing_key:
|
115
116
|
specification_version: 4
|
116
117
|
summary: Jekyll extensions for the academic blogger.
|
@@ -121,6 +122,7 @@ test_files:
|
|
121
122
|
- features/details.feature
|
122
123
|
- features/filter.feature
|
123
124
|
- features/reference.feature
|
125
|
+
- features/repository.feature
|
124
126
|
- features/sorting.feature
|
125
127
|
- features/step_definitions/jekyll_steps.rb
|
126
128
|
- features/step_definitions/scholar_steps.rb
|