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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2VlZTg5Njk5MjEzNjZhMmQxYjZmYzc2ZTBmMTdlODJlYTBmNzAyZg==
4
+ YjIwNWM2NmQ3MWVlMDdlMGU4MTBjMjUyYmZiNmNhZjdlMjEzYTJiOA==
5
5
  data.tar.gz: !binary |-
6
- OGNmMjQ4NzA1MWUzOThhMjEzNjgyYWFjYzA1ZWUwYTc4YmExMTc5OQ==
6
+ YTg5Y2YxZDMyN2Y3N2Q2MTU5OWQwZWM0MWI3OGU1MWYwODg0OWVkZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjhiNGUzYWQ3NTk0MDY4MDQ1OWZkMGYzYjlmYzJhMmY0Njk3YzhhMzRjYjMw
10
- ODdmYzU0ZmFmNWY1OGU2ZDQ2Yzg4MGMxZmE2NDk3NWY2ZTM4ZmZjOGM2NDI4
11
- MWFmNTEyYmEzYmYzNTk5ODIyNTVhMzY3NGI4MTBkMWNjNjUzMzE=
9
+ MmI1YTYzMmFjYzJkMDVhOTJmMTAyOWFmMmI4YzY1NTNiNmU0NGI4NjQ5OGI2
10
+ ODM4NDFlNWIwNTBhZmVhYzkxOWQ1ZDk5MzU4ZWVmMjVmZDZlMTQ1YTYwM2M0
11
+ NzdkOTFjYjc5MGM3N2Y5NzNlOWE1ZmYzMTRhNmVmZjMzZWQxZjY=
12
12
  data.tar.gz: !binary |-
13
- MzVjYTkzMjhjYzU0MjYxZWVkODBkZTI3MDY4Y2VlNjQxNzY0ZGViYTVjMTAz
14
- MjIxYzBjNTFjMDNmYjVjYzQ4ODA3MGY3YzZhM2YwYzc4YmMwMWFhNWFmYzUx
15
- ODFhNTMzODcxZjhiNDYyYjgwNjA3MGNiY2FjNDRmMGJmZmJjMWU=
13
+ YThmN2Q5ZTY0MDc2MzM1NTM5Y2E4NjlmZjdjNDFlODY4NDIzYWJkYTEyZTk3
14
+ MDA1NGQ1OGY3ZjAzNDlmOTgzNjk2ZjAwMmEyZmJiZDJhOWY3MWQ1ZTkxNzhk
15
+ MDZkYWUwOTliNmU1ZTU0ZjM1ODg5YjlhMmQ2NmFhMDI4MzRmOGQ=
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ bundler_args: --without debug
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.2
6
+ - 1.9.3
7
+ notifications:
8
+ email:
9
+ recipients:
10
+ - sylvester@keil.or.at
11
+ on_success: change
12
+ on_failure: always
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
- gem 'debugger'
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&#8217;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
- #### Citations to multiple bibliographies within one document (like [multibib.sty](http://www.ctan.org/pkg/multibib))
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 serveral lists containing the same
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
- occurence of the `id`. Moreover, valid HTML requires unique `id`
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 References
280
- section., even if both posts will be rendered into a single HTML
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 bibtex-ruby 2.0.7 or
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
- $:.unshift '/full/path/to/the/repository/lib'
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 where you have cloned jekyll-scholar into.
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
@@ -4,156 +4,184 @@ Feature: BibTeX
4
4
  In order to share my awesome references with my peers
5
5
 
6
6
  @converters
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"
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
- Scenario: Markdown Formatted Bibliography
28
+ Scenario: Markdown Formatted Bibliography
29
29
  Given I have a scholar configuration with:
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"
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
- Scenario: Simple Bibliography with LaTeX directives
50
+ Scenario: Simple Bibliography with LaTeX directives
51
51
  Given I have a scholar configuration with:
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"
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
- Scenario: Simple Bibliography Loaded From Default Directory
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
- | 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"
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
- Scenario: Filtered Bibliography Loaded From Default Directory
122
+ Scenario: Filtered Bibliography Loaded From Default Directory
95
123
  Given I have a scholar configuration with:
96
- | key | value |
97
- | source | ./_bibliography |
98
- And I have a "_bibliography" directory
99
- And I have a file "_bibliography/references.bib":
100
- """
101
- @book{ruby,
102
- title = {The Ruby Programming Language},
103
- author = {Flanagan, David and Matsumoto, Yukihiro},
104
- year = {2008},
105
- publisher = {O'Reilly Media}
106
- },
107
- @book{smalltalk,
108
- title = {Smalltalk Best Practice Patterns},
109
- author = {Kent Beck},
110
- year = {1996},
111
- publisher = {Prentice Hall}
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
- And I have a page "scholar.html":
116
- """
117
- ---
118
- ---
119
- {% bibliography -f references --query @book[year <= 2000] %}
120
- """
121
- When I run jekyll
122
- Then the _site directory should exist
123
- And the "_site/scholar.html" file should exist
124
- And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
125
- And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
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
- Scenario: A Prefixed Bibliography
156
+ Scenario: A Prefixed Bibliography
129
157
  Given I have a scholar configuration with:
130
- | key | value |
131
- | source | ./_bibliography |
132
- And I have a "_bibliography" directory
133
- And I have a file "_bibliography/references.bib":
134
- """
135
- @book{ruby,
136
- title = {The Ruby Programming Language},
137
- author = {Flanagan, David and Matsumoto, Yukihiro},
138
- year = {2008},
139
- publisher = {O'Reilly Media}
140
- },
141
- @book{smalltalk,
142
- title = {Smalltalk Best Practice Patterns},
143
- author = {Kent Beck},
144
- year = {1996},
145
- publisher = {Prentice Hall}
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
- And I have a page "scholar.html":
150
- """
151
- ---
152
- ---
153
- {% bibliography --file references --prefix a -q @book[year <= 2000] %}
154
- """
155
- When I run jekyll
156
- Then the _site directory should exist
157
- And the "_site/scholar.html" file should exist
158
- And I should not see "ruby" in "_site/scholar.html"
159
- And I should see "id=\"a-smalltalk\"" in "_site/scholar.html"
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"