jekyll-scholar 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/README.md +33 -0
- data/features/details.feature +37 -0
- data/features/support/env.rb +3 -2
- data/lib/jekyll/scholar.rb +8 -0
- data/lib/jekyll/scholar/generators/details.rb +71 -0
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +29 -26
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -34,6 +34,10 @@ default configuration is as follows:
|
|
34
34
|
|
35
35
|
source: ./_bibliography
|
36
36
|
bibliography: references.bib
|
37
|
+
|
38
|
+
details_dir ./bibliography
|
39
|
+
details_layout bibtex.html
|
40
|
+
|
37
41
|
|
38
42
|
You can use any style that ships with
|
39
43
|
[CiteProc-Ruby](https://github.com/inukshuk/citeproc-ruby) by name (e.g.,
|
@@ -147,6 +151,35 @@ following blog post:
|
|
147
151
|
|
148
152
|
{% bibliography %}
|
149
153
|
|
154
|
+
### Detail Pages
|
155
|
+
|
156
|
+
If your layouts directory contains a layout file for bibliography details
|
157
|
+
(the 'details_layout' configuration options), Jekyll-Scholar will generate
|
158
|
+
a details page for each entry in you main bibliography. That is to say, if
|
159
|
+
your bibliography contains the following entry:
|
160
|
+
|
161
|
+
@book{ruby,
|
162
|
+
title = {The Ruby Programming Language},
|
163
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
164
|
+
year = {2008},
|
165
|
+
publisher = {O'Reilly Media}
|
166
|
+
}
|
167
|
+
|
168
|
+
Then a page 'bibliography/ruby.html' will be generated according to your
|
169
|
+
details page layout. In the layout file, you have access to all fields
|
170
|
+
of your BibTeX entry. Here is an example of a details page layout:
|
171
|
+
|
172
|
+
---
|
173
|
+
---
|
174
|
+
<html>
|
175
|
+
<head></head>
|
176
|
+
<body>
|
177
|
+
<h1>{{ page.entry.title }}</h1>
|
178
|
+
<h2>{{ page.entry.author }}</h2>
|
179
|
+
<p>{{ page.entry.abstract }}</p>
|
180
|
+
</body>
|
181
|
+
</html>
|
182
|
+
|
150
183
|
|
151
184
|
Contributing
|
152
185
|
------------
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Feature: BibTeX
|
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 detail pages for all the entries in my bibliography
|
5
|
+
|
6
|
+
@generators
|
7
|
+
Scenario: A bibliography with a single entry
|
8
|
+
Given I have a scholar configuration with:
|
9
|
+
| key | value |
|
10
|
+
| source | ./_bibliography |
|
11
|
+
| details_layout | details.html |
|
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
|
+
And I have a "_layouts" directory
|
23
|
+
And I have a file "_layouts/details.html":
|
24
|
+
"""
|
25
|
+
---
|
26
|
+
---
|
27
|
+
<html>
|
28
|
+
<head></head>
|
29
|
+
<body>
|
30
|
+
{{ page.entry.title }}
|
31
|
+
</body>
|
32
|
+
</html>
|
33
|
+
"""
|
34
|
+
When I run jekyll
|
35
|
+
Then the _site directory should exist
|
36
|
+
And the "_site/bibliography/ruby.html" file should exist
|
37
|
+
And I should see "<i>The Ruby Programming Language</i>" in "_site/bibliography/ruby.html"
|
data/features/support/env.rb
CHANGED
data/lib/jekyll/scholar.rb
CHANGED
@@ -8,17 +8,25 @@ require 'jekyll/scholar/version'
|
|
8
8
|
require 'jekyll/scholar/converters/bibtex'
|
9
9
|
require 'jekyll/scholar/tags/bibliography'
|
10
10
|
require 'jekyll/scholar/tags/cite'
|
11
|
+
require 'jekyll/scholar/generators/details'
|
11
12
|
|
12
13
|
module Jekyll
|
13
14
|
class Scholar
|
14
15
|
|
15
16
|
@defaults = Hash[*%w{
|
17
|
+
|
16
18
|
style apa
|
17
19
|
locale en
|
20
|
+
|
18
21
|
sort_by none
|
19
22
|
order ascending
|
23
|
+
|
20
24
|
source ./_bibliography
|
21
25
|
bibliography references.bib
|
26
|
+
|
27
|
+
details_dir ./bibliography
|
28
|
+
details_layout bibtex.html
|
29
|
+
|
22
30
|
}].freeze
|
23
31
|
|
24
32
|
class << self
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class Scholar
|
3
|
+
|
4
|
+
class Details < Page
|
5
|
+
|
6
|
+
attr_reader :config
|
7
|
+
|
8
|
+
def initialize(site, base, dir, entry)
|
9
|
+
@site, @base, @dir = site, base, dir
|
10
|
+
|
11
|
+
@config = Scholar.defaults.merge(site.config['scholar'] || {})
|
12
|
+
|
13
|
+
@name = [entry.key, 'html'].join('.')
|
14
|
+
|
15
|
+
process(@name)
|
16
|
+
read_yaml(File.join(base, '_layouts'), config['details_layout'])
|
17
|
+
|
18
|
+
liquidify(entry)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def liquidify(entry)
|
24
|
+
data['entry'] = {}
|
25
|
+
|
26
|
+
data['entry']['key'] = entry.key
|
27
|
+
data['entry']['type'] = entry.type
|
28
|
+
|
29
|
+
entry.fields.each do |key, value|
|
30
|
+
data['entry'][key.to_s] = value.to_s
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
class DetailsGenerator < Generator
|
37
|
+
safe true
|
38
|
+
|
39
|
+
attr_reader :config
|
40
|
+
|
41
|
+
def generate(site)
|
42
|
+
@config = Scholar.defaults.merge(site.config['scholar'] || {})
|
43
|
+
|
44
|
+
if site.layouts.key?(File.basename(config['details_layout'], '.html'))
|
45
|
+
bibliography.each do |entry|
|
46
|
+
details = Details.new(site, site.source, config['details_dir'], entry)
|
47
|
+
details.render(site.layouts, site.site_payload)
|
48
|
+
details.write(site.dest)
|
49
|
+
|
50
|
+
site.pages << details
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def bibliography
|
59
|
+
@bibliography ||= BibTeX.open(bibliography_path, :filter => :latex)
|
60
|
+
end
|
61
|
+
|
62
|
+
def bibliography_path
|
63
|
+
p = File.join(config['source'], config['bibliography'])
|
64
|
+
p << '.bib' unless File.exists?(p)
|
65
|
+
p
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-scholar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jekyll
|
16
|
-
requirement: &
|
16
|
+
requirement: &70309233363880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.10'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70309233363880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: citeproc-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &70309233363360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.0.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70309233363360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bibtex-ruby
|
38
|
-
requirement: &
|
38
|
+
requirement: &70309233362460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.0.5
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70309233362460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &70309233361220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0.9'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70309233361220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rdoc
|
60
|
-
requirement: &
|
60
|
+
requirement: &70309233358000 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '3.11'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70309233358000
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redgreen
|
71
|
-
requirement: &
|
71
|
+
requirement: &70309233372520 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '1.2'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70309233372520
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: shoulda
|
82
|
-
requirement: &
|
82
|
+
requirement: &70309233371740 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '2.11'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70309233371740
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rr
|
93
|
-
requirement: &
|
93
|
+
requirement: &70309233371260 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '1.0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70309233371260
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: cucumber
|
104
|
-
requirement: &
|
104
|
+
requirement: &70309233370720 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - =
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '1.1'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70309233370720
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: RedCloth
|
115
|
-
requirement: &
|
115
|
+
requirement: &70309233370180 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '4.2'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70309233370180
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rdiscount
|
126
|
-
requirement: &
|
126
|
+
requirement: &70309233369560 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '1.6'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70309233369560
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: redcarpet
|
137
|
-
requirement: &
|
137
|
+
requirement: &70309233368920 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: '1.9'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70309233368920
|
146
146
|
description: A set of jekyll extensions for academic blogging.
|
147
147
|
email: http://sylvester.keil.or.at
|
148
148
|
executables: []
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- README.md
|
156
156
|
- features/bibtex.feature
|
157
157
|
- features/citation.feature
|
158
|
+
- features/details.feature
|
158
159
|
- features/sorting.feature
|
159
160
|
- features/step_definitions/jekyll_steps.rb
|
160
161
|
- features/step_definitions/scholar_steps.rb
|
@@ -162,6 +163,7 @@ files:
|
|
162
163
|
- jekyll-scholar.gemspec
|
163
164
|
- lib/jekyll/scholar.rb
|
164
165
|
- lib/jekyll/scholar/converters/bibtex.rb
|
166
|
+
- lib/jekyll/scholar/generators/details.rb
|
165
167
|
- lib/jekyll/scholar/tags/bibliography.rb
|
166
168
|
- lib/jekyll/scholar/tags/cite.rb
|
167
169
|
- lib/jekyll/scholar/version.rb
|
@@ -192,6 +194,7 @@ summary: Jekyll extensions for the academic blogger.
|
|
192
194
|
test_files:
|
193
195
|
- features/bibtex.feature
|
194
196
|
- features/citation.feature
|
197
|
+
- features/details.feature
|
195
198
|
- features/sorting.feature
|
196
199
|
- features/step_definitions/jekyll_steps.rb
|
197
200
|
- features/step_definitions/scholar_steps.rb
|