jekyll-scholar 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -177,6 +177,32 @@ For example, this could be rendered as:
177
177
  </cite>
178
178
  </blockquote>
179
179
 
180
+ #### Displaying formatted references
181
+
182
+ If you want to display the full formatted reference entry, you can use the
183
+ `reference` tag. For example, given the following Bibtex entry,
184
+
185
+ @book{ruby,
186
+ title = {The Ruby Programming Language},
187
+ author = {Flanagan, David and Matsumoto, Yukihiro},
188
+ year = {2008},
189
+ publisher = {O'Reilly Media}
190
+ }
191
+
192
+ using `{% reference ruby %}` anywhere in your page, it will print
193
+ "Flanagan, D., & Matsumoto, Y. (2008). *The Ruby Programming Language.*.
194
+ O'Reilly Media" (the exact result depends on your formatting style).
195
+
196
+ The `reference` tag accepts a second optional argument that specifies the
197
+ absolute path of the BibTeX file to use as input. Using it, you can override
198
+ the file from which the bib entries are read. This can be handy if you
199
+ want to use a special BibTeX file as input for a specific page. As an example,
200
+ the tag
201
+
202
+ {% reference ruby, /home/foo/bar.bib %}
203
+
204
+ will attempt to read the key `ruby` from file `/home/foo/bar.bib`. It will not
205
+ fallback to the default BibTeX file.
180
206
 
181
207
  ### Detail Pages
182
208
 
@@ -253,7 +279,6 @@ If you've found a bug or have a question, please open an issue on the
253
279
  Or, for extra credit, clone the Jekyll-Scholar repository, write a failing
254
280
  example, fix the bug and submit a pull request.
255
281
 
256
-
257
282
  License
258
283
  -------
259
284
 
@@ -0,0 +1,57 @@
1
+ Feature: Formatted References
2
+ As a scholar who likes to blog
3
+ I want to reference cool papers and books from my bibliography
4
+
5
+ @tags @referebce
6
+ Scenario: A Simple Reference
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
+ {% reference ruby %}
26
+ """
27
+ When I run jekyll
28
+ Then the _site directory should exist
29
+ And the "_site/scholar.html" file should exist
30
+ And I should see "Matsumoto, Y. \(2008\). <i>The Ruby" in "_site/scholar.html"
31
+
32
+ @tags @reference
33
+ Scenario: Missing references
34
+ Given I have a scholar configuration with:
35
+ | key | value |
36
+ | source | ./_bibliography |
37
+ | bibliography | my_references |
38
+ And I have a "_bibliography" directory
39
+ And I have a file "_bibliography/my_references.bib":
40
+ """
41
+ @book{ruby,
42
+ title = {The Ruby Programming Language},
43
+ author = {Flanagan, David and Matsumoto, Yukihiro},
44
+ year = {2008},
45
+ publisher = {O'Reilly Media}
46
+ }
47
+ """
48
+ And I have a page "scholar.html":
49
+ """
50
+ ---
51
+ ---
52
+ {% reference java %}
53
+ """
54
+ When I run jekyll
55
+ Then the _site directory should exist
56
+ And the "_site/scholar.html" file should exist
57
+ And I should see "missing reference" in "_site/scholar.html"
@@ -13,4 +13,5 @@ require 'jekyll/scholar/tags/bibliography'
13
13
  require 'jekyll/scholar/tags/cite'
14
14
  require 'jekyll/scholar/tags/cite_details'
15
15
  require 'jekyll/scholar/tags/quote'
16
+ require 'jekyll/scholar/tags/reference'
16
17
  require 'jekyll/scholar/generators/details'
@@ -0,0 +1,43 @@
1
+ module Jekyll
2
+ class Scholar
3
+
4
+ class ReferenceTag < Liquid::Tag
5
+ include Scholar::Utilities
6
+
7
+ attr_reader :key, :file
8
+
9
+ def initialize(tag_name, arguments, tokens)
10
+ super
11
+
12
+ @config = Scholar.defaults.dup
13
+ @key, @file = arguments.strip.split(/\s*,\s*/, 2)
14
+ end
15
+
16
+ def render(context)
17
+ set_context_to context
18
+ bib = unless file.nil?
19
+ BibTeX.open(file, { :filter => :latex })
20
+ else
21
+ set_context_to context
22
+ bibliography
23
+ end
24
+
25
+ entry = bib[key]
26
+
27
+ if bib.key?(key)
28
+ CiteProc.process entry.to_citeproc,
29
+ :style => config['style'],
30
+ :locale => config['locale'],
31
+ :format => 'html'
32
+ else
33
+ "(missing reference)"
34
+ end
35
+ rescue
36
+ "(#{key})"
37
+ end
38
+ end
39
+
40
+ end
41
+ end
42
+
43
+ Liquid::Template.register_tag('reference', Jekyll::Scholar::ReferenceTag)
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  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.1.0
4
+ version: 0.2.0
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-08-04 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
16
- requirement: &70230385479620 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0.10'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70230385479620
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.10'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: citeproc-ruby
27
- requirement: &70230385479100 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 0.0.6
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70230385479100
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.6
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: bibtex-ruby
38
- requirement: &70230385478620 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 2.0.7
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70230385478620
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.7
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rake
49
- requirement: &70230385478160 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0.9'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70230385478160
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '0.9'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rdoc
60
- requirement: &70230385477680 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '3.11'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70230385477680
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '3.11'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: redgreen
71
- requirement: &70230385477180 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '1.2'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70230385477180
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.2'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: shoulda
82
- requirement: &70230385476700 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ~>
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '2.11'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70230385476700
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '2.11'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: rr
93
- requirement: &70230385476240 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ~>
@@ -98,21 +133,31 @@ dependencies:
98
133
  version: '1.0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *70230385476240
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '1.0'
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: cucumber
104
- requirement: &70230385475780 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
- - - =
147
+ - - '='
108
148
  - !ruby/object:Gem::Version
109
149
  version: '1.1'
110
150
  type: :development
111
151
  prerelease: false
112
- version_requirements: *70230385475780
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - '='
156
+ - !ruby/object:Gem::Version
157
+ version: '1.1'
113
158
  - !ruby/object:Gem::Dependency
114
159
  name: RedCloth
115
- requirement: &70230385475320 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
116
161
  none: false
117
162
  requirements:
118
163
  - - ~>
@@ -120,10 +165,15 @@ dependencies:
120
165
  version: '4.2'
121
166
  type: :development
122
167
  prerelease: false
123
- version_requirements: *70230385475320
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: '4.2'
124
174
  - !ruby/object:Gem::Dependency
125
175
  name: rdiscount
126
- requirement: &70230385495740 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
127
177
  none: false
128
178
  requirements:
129
179
  - - ~>
@@ -131,10 +181,15 @@ dependencies:
131
181
  version: '1.6'
132
182
  type: :development
133
183
  prerelease: false
134
- version_requirements: *70230385495740
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ~>
188
+ - !ruby/object:Gem::Version
189
+ version: '1.6'
135
190
  - !ruby/object:Gem::Dependency
136
191
  name: redcarpet
137
- requirement: &70230385495240 !ruby/object:Gem::Requirement
192
+ requirement: !ruby/object:Gem::Requirement
138
193
  none: false
139
194
  requirements:
140
195
  - - ~>
@@ -142,7 +197,12 @@ dependencies:
142
197
  version: '1.9'
143
198
  type: :development
144
199
  prerelease: false
145
- version_requirements: *70230385495240
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ~>
204
+ - !ruby/object:Gem::Version
205
+ version: '1.9'
146
206
  description: ! ' Jekyll-Scholar is for all the academic bloggers out there. It is
147
207
  a set of extensions for Jekyll the awesome, blog aware, static site generator; it
148
208
  formats your BibTeX bibliographies for the web using CSL citation styles and generally
@@ -161,6 +221,7 @@ files:
161
221
  - features/cite_details.feature
162
222
  - features/details.feature
163
223
  - features/filter.feature
224
+ - features/reference.feature
164
225
  - features/sorting.feature
165
226
  - features/step_definitions/jekyll_steps.rb
166
227
  - features/step_definitions/scholar_steps.rb
@@ -174,6 +235,7 @@ files:
174
235
  - lib/jekyll/scholar/tags/cite.rb
175
236
  - lib/jekyll/scholar/tags/cite_details.rb
176
237
  - lib/jekyll/scholar/tags/quote.rb
238
+ - lib/jekyll/scholar/tags/reference.rb
177
239
  - lib/jekyll/scholar/utilities.rb
178
240
  - lib/jekyll/scholar/version.rb
179
241
  homepage: http://github.com/inukshuk/jekyll-scholar
@@ -196,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
258
  version: 1.3.6
197
259
  requirements: []
198
260
  rubyforge_project: jekyll-scholar
199
- rubygems_version: 1.8.10
261
+ rubygems_version: 1.8.24
200
262
  signing_key:
201
263
  specification_version: 3
202
264
  summary: Jekyll extensions for the academic blogger.
@@ -206,6 +268,7 @@ test_files:
206
268
  - features/cite_details.feature
207
269
  - features/details.feature
208
270
  - features/filter.feature
271
+ - features/reference.feature
209
272
  - features/sorting.feature
210
273
  - features/step_definitions/jekyll_steps.rb
211
274
  - features/step_definitions/scholar_steps.rb