jekyll-scholar 5.11.0 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3a12c04213d5d4a7f2b7e6915f4484a2b0cd50d6
4
- data.tar.gz: b028593919ff9c53a799f814727bae13fd8ddb64
2
+ SHA256:
3
+ metadata.gz: 58e25d6efe7c8dee59ef300050b011a440db405e8faf3d67df0a7cd338f66463
4
+ data.tar.gz: 95d5957d275047e9039124fa70e33662450e8e7032671c3639ce7d5247dd83ad
5
5
  SHA512:
6
- metadata.gz: 37de3db56995dd2a662b8606d07a597beba91df7454ca2139fc3238a9212a47e7222c5a91b154ea7ed028664ed52dd65d4c52a7d412f1dc172cf5c6c7d1062e1
7
- data.tar.gz: f45693b66aea36d5af8aae6ad0210e5325fbf7cca0e60aeac77b9c4d4b010200999e5f56c84f8c7a70aed4fe1380ee6b06dfc4a27de4d644e2e3237800eab788
6
+ metadata.gz: 386d44e9ad73e9f48ffc82c7bce87347a3087192358227271962df940e046c64df085af49c40040e1d9779494476005b371f0f66501746fdeaab2a4449446656
7
+ data.tar.gz: e39490aa41dee0744b9a1eb158d0e7e1b16c48c97f4e74147708d1f4c57b2fa9ce49022234840531c1ce51e1d125861cb35882d1afc986bd510f0069069158f1
data/.travis.yml CHANGED
@@ -3,8 +3,10 @@ sudo: false
3
3
  cache: bundler
4
4
  matrix:
5
5
  include:
6
- - rvm: 2.4
6
+ - rvm: 2.5
7
7
  env: WITH_COVERALLS=true
8
+ - rvm: 2.4
9
+ env: WITH_COVERALLS=false
8
10
  - rvm: 2.3
9
11
  env: WITH_COVERALLS=false
10
12
  install:
data/Gemfile CHANGED
@@ -13,8 +13,6 @@ group :development do
13
13
  gem 'shoulda', '~> 3.5'
14
14
  gem 'cucumber', '1.3.11'
15
15
  gem 'redcarpet'
16
-
17
- gem 'unicode_utils'
18
16
  end
19
17
 
20
18
  group :extra do
data/README.md CHANGED
@@ -68,7 +68,7 @@ description of all options and their defaults, see
68
68
  | `style` | `apa` | Indicates the style used for the bibliography and citations. You can use any style that ships with [CiteProc-Ruby](https://github.com/inukshuk/citeproc-ruby) by name (e.g., apa, mla, chicago-fullnote-bibliography) which is usually the filename as seen [here](https://github.com/citation-style-language/styles) without the `.csl` ending; note that you have to use `dependent/style` if you want to use one from that directory. Alternatively you can add a link to any CSL style (e.g., you could link to any of the styles available at the official [CSL style repository](https://github.com/citation-style-language/styles)). |
69
69
  | `locale` | `en` | Defines what language to use when formatting your references (this typically applies to localized terms, e.g., 'Eds.' for editors in English). |
70
70
  | `source` | `./_bibliography` | Indicates where your bibliographies are stored. |
71
- | `bibliography` | `references.bib` | Indicates the name of your default bibliography. For best results, please ensure that your bibliography is encoded as ASCII or UTF-8. |
71
+ | `bibliography` | `references.bib` | Indicates the name of your default bibliography. For best results, please ensure that your bibliography is encoded as ASCII or UTF-8. A string that contains a `*` will be passed to `Dir::glob`, so `**/*.bib{,tex}` will find all files named `*.bib` and `*.bibtex` under `source`. |
72
72
  | `use_raw_bibtex_entry` | `true` | When `true`, disables parsing of Liquid tags embedded in the Bibtex fields. This option provides a way to circumvent the problem that (the conflicting syntax of) the double braces functionality of BibTex is accidentally parsed by Liquid, while it was intended to keep the exact capitalization style. |
73
73
  | `sort_by` | `none` | Specifies if and how bibliography entries are sorted. Entries can be sorted on multiple fields, by using a list of keys, e.g. `year,month`. Ordering can be specified per sort level, e.g. `order: descending,ascending` will sort the years descending, but per year the months are ascending. If there are more sort keys than order directives, the last order entry is used for the remaining keys. |
74
74
  | `order` | `ascending` | Specifies order bibliography entries are sorted in. Can be `ascending` or descending. Ordering can be specified per sort level, e.g. `descending,ascending` will sort in descending on the first key then ascending order on the second key. If there are more sort keys than order directives, the last order entry is used for the remaining keys. |
@@ -167,6 +167,17 @@ This would generate a bibliography containing only the first 5 entries
167
167
  of your bibliography (after query filters and sort options have been
168
168
  applied). Limiting entries is disabled if grouping is active.
169
169
 
170
+ ### Return number of publications in bibliography
171
+
172
+ The `bibliography_count` returns the number of items that would be
173
+ rendered in a bibliography. This tag accepts the same parameters as the
174
+ `bibliography` tag.
175
+
176
+ {% bibliography_count -f references --query @book[year <=2000] %}
177
+
178
+ See [#186](https://github.com/inukshuk/jekyll-scholar/blob/master/features/186.feature)
179
+ for further examples.
180
+
170
181
  ### Bibliography Template
171
182
 
172
183
  Your bibliography is always rendered as an ordered list. Additionally,
@@ -160,7 +160,7 @@ Feature: Details
160
160
  Given I have a scholar configuration with:
161
161
  | key | value |
162
162
  | source | ./_bibliography |
163
- | bibliogaphy | references |
163
+ | bibliography | references |
164
164
  | details_layout | details.html |
165
165
  And I have a "_bibliography" directory
166
166
  And I have a file "_bibliography/references.bib":
@@ -196,13 +196,65 @@ Feature: Details
196
196
  And the "_site/bibliography/ruby.html" file should exist
197
197
  And I should see "<a[^>]+href=\"/bibliography/ruby.html\">" in "_site/scholar.html"
198
198
 
199
+ @tags @details
200
+ Scenario: Links to Detail Pages are Generated Automatically With Globbing
201
+ Given I have a scholar configuration with:
202
+ | key | value |
203
+ | source | ./_bibliography |
204
+ | bibliography | "*.bib" |
205
+ | details_layout | details.html |
206
+ And I have a "_bibliography" directory
207
+ And I have a file "_bibliography/a.bib":
208
+ """
209
+ @book{a,
210
+ title = {The Ruby Programming Language},
211
+ author = {Flanagan, David and Matsumoto, Yukihiro},
212
+ year = {2008},
213
+ publisher = {O'Reilly Media}
214
+ }
215
+ """
216
+ And I have a file "_bibliography/b.bib":
217
+ """
218
+ @book{b,
219
+ title = {The Ruby Programming Language},
220
+ author = {Flanagan, David and Matsumoto, Yukihiro},
221
+ year = {2008},
222
+ publisher = {O'Reilly Media}
223
+ }
224
+ """
225
+ And I have a "_layouts" directory
226
+ And I have a file "_layouts/details.html":
227
+ """
228
+ ---
229
+ ---
230
+ <html>
231
+ <head></head>
232
+ <body>
233
+ {{ page.entry.title }}
234
+ </body>
235
+ </html>
236
+ """
237
+ And I have a page "scholar.html":
238
+ """
239
+ ---
240
+ ---
241
+ {% bibliography %}
242
+ """
243
+ When I run jekyll
244
+ Then the _site directory should exist
245
+ And the "_site/scholar.html" file should exist
246
+ And the "_site/bibliography/a.html" file should exist
247
+ And the "_site/bibliography/b.html" file should exist
248
+ And I should see "<a[^>]+href=\"/bibliography/a.html\">" in "_site/scholar.html"
249
+ And I should see "<a[^>]+href=\"/bibliography/b.html\">" in "_site/scholar.html"
250
+
199
251
  @tags @details
200
252
  Scenario: Links to Detail Pages Work With Pretty URLs
201
253
  Given I have a configuration file with "permalink" set to "pretty"
202
254
  And I have a scholar configuration with:
203
255
  | key | value |
204
256
  | source | ./_bibliography |
205
- | bibliogaphy | references |
257
+ | bibliography | references |
206
258
  | details_layout | details.html |
207
259
  And I have a "_bibliography" directory
208
260
  And I have a file "_bibliography/references.bib":
@@ -239,6 +291,49 @@ Feature: Details
239
291
  And I should see "<a[^>]+href=\"/bibliography/ruby/\">" in "_site/scholar/index.html"
240
292
  And the "_site/bibliography/ruby/index.html" file should exist
241
293
 
294
+ @tags @details
295
+ Scenario: Links to Detail Pages Work With Custom Permalink URLs
296
+ Given I have a configuration file with "permalink" set to "/:title/"
297
+ And I have a scholar configuration with:
298
+ | key | value |
299
+ | source | ./_bibliography |
300
+ | bibliography | references |
301
+ | details_layout | details.html |
302
+ And I have a "_bibliography" directory
303
+ And I have a file "_bibliography/references.bib":
304
+ """
305
+ @book{ruby,
306
+ title = {The Ruby Programming Language},
307
+ author = {Flanagan, David and Matsumoto, Yukihiro},
308
+ year = {2008},
309
+ publisher = {O'Reilly Media}
310
+ }
311
+ """
312
+ And I have a "_layouts" directory
313
+ And I have a file "_layouts/details.html":
314
+ """
315
+ ---
316
+ ---
317
+ <html>
318
+ <head></head>
319
+ <body>
320
+ {{ page.entry.title }}
321
+ </body>
322
+ </html>
323
+ """
324
+ And I have a page "scholar.html":
325
+ """
326
+ ---
327
+ ---
328
+ {% bibliography %}
329
+ """
330
+ When I run jekyll
331
+ Then the _site directory should exist
332
+ And I should see "/:title/" in "_config.yml"
333
+ And the "_site/scholar/index.html" file should exist
334
+ And I should see "<a[^>]+href=\"/bibliography/ruby/\">" in "_site/scholar/index.html"
335
+ And the "_site/bibliography/ruby/index.html" file should exist
336
+
242
337
  @generators @parse_months
243
338
  Scenario: Months are parsed by default
244
339
  Given I have a scholar configuration with:
@@ -295,7 +390,7 @@ Feature: Details
295
390
  Given I have a scholar configuration with:
296
391
  | key | value |
297
392
  | source | ./_bibliography |
298
- | bibliogaphy | references |
393
+ | bibliography | references |
299
394
  And I have a "_bibliography" directory
300
395
  And I have a file "_bibliography/references.bib":
301
396
  """
@@ -0,0 +1,83 @@
1
+ Feature: Interpolations ...
2
+ As a scholar who likes to blog
3
+ I want to reference cool papers and books from my bibliography
4
+
5
+ @tags @reference @liquid @interpolate
6
+ Scenario: Interpolate liquid variables
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 file "custom.csl":
22
+ """
23
+ <style>
24
+ <citation>
25
+ <layout>
26
+ <text variable="title"/>
27
+ </layout>
28
+ </citation>
29
+ <bibliography>
30
+ <layout>
31
+ <text variable="title"/>
32
+ </layout>
33
+ </bibliography>
34
+ </style>
35
+ """
36
+ And I have a page "scholar.html":
37
+ """
38
+ ---
39
+ ---
40
+ {% assign style_file = 'custom.csl' %}
41
+ {% bibliography --style {{style_file}} %}
42
+ """
43
+ When I run jekyll
44
+ Then the _site directory should exist
45
+ And the "_site/scholar.html" file should exist
46
+ And I should see "The Ruby Programming Language" in "_site/scholar.html"
47
+
48
+
49
+ @tags @grouping
50
+ Scenario: Local grouping override - grouping by year with interpolation
51
+ Given I have a scholar configuration with:
52
+ | key | value |
53
+ | group_by | none |
54
+ | group_order | ascending |
55
+ And I have a "_bibliography" directory
56
+ And I have a file "_bibliography/references.bib":
57
+ """
58
+ @book{ruby1,
59
+ title = {The Ruby Programming Language},
60
+ author = {Flanagan, David and Matsumoto, Yukihiro},
61
+ year = {2008},
62
+ publisher = {O'Reilly Media}
63
+ }
64
+ @book{ruby2,
65
+ title = {The Ruby Programming Language},
66
+ author = {Flanagan, David and Matsumoto, Yukihiro},
67
+ year = {2007},
68
+ publisher = {O'Reilly Media}
69
+ }
70
+ """
71
+ And I have a page "scholar.html":
72
+ """
73
+ ---
74
+ ---
75
+ {% assign group_year = 'year' %}
76
+ {% bibliography -f references --group_by {{group_year}} --group_order descending %}
77
+ """
78
+ When I run jekyll
79
+ Then the _site directory should exist
80
+ And the "_site/scholar.html" file should exist
81
+ Then I should see "<h2 class=\"bibliography\">2007</h2>" in "_site/scholar.html"
82
+ And I should see "<h2 class=\"bibliography\">2008</h2>" in "_site/scholar.html"
83
+ And "2008" should come before "2007" in "_site/scholar.html"
@@ -59,7 +59,7 @@ module Jekyll
59
59
  end
60
60
 
61
61
  def render_items(items)
62
- bibliography = items.each_with_index.map { |entry, index|
62
+ bibliography = items.compact.each_with_index.map { |entry, index|
63
63
  reference = bibliography_tag(entry, index + 1)
64
64
 
65
65
  if generate_details?
@@ -122,6 +122,11 @@ module Jekyll
122
122
  end
123
123
 
124
124
  def bibtex_files
125
+ if config['bibliography'].include? '*'
126
+ @bibtex_files ||= Dir.glob(File.join(config["source"], config['bibliography'])).collect do |f|
127
+ Pathname(f).relative_path_from(Pathname(config['source'])).to_s
128
+ end
129
+ end
125
130
  @bibtex_files ||= [config['bibliography']]
126
131
  end
127
132
 
@@ -222,7 +227,7 @@ module Jekyll
222
227
  end
223
228
 
224
229
  def group_by
225
- @group_by ||= config['group_by']
230
+ @group_by = interpolate(@group_by) || config['group_by']
226
231
  end
227
232
 
228
233
  def group?
@@ -436,7 +441,7 @@ module Jekyll
436
441
  end
437
442
 
438
443
  def style
439
- @style || config['style']
444
+ interpolate(@style)|| config['style']
440
445
  end
441
446
 
442
447
  def missing_reference
@@ -557,6 +562,8 @@ module Jekyll
557
562
 
558
563
  if site.config['permalink'] == 'pretty'
559
564
  name << '/'
565
+ elsif site.config['permalink'].end_with? '/'
566
+ name << '/'
560
567
  else
561
568
  name << '.html'
562
569
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '5.11.0'.freeze
3
+ VERSION = '5.12.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-scholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.11.0
4
+ version: 5.12.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: 2018-01-05 00:00:00.000000000 Z
11
+ date: 2018-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -100,6 +100,7 @@ files:
100
100
  - features/details.feature
101
101
  - features/filter.feature
102
102
  - features/grouping.feature
103
+ - features/interpolate.feature
103
104
  - features/layout.feature
104
105
  - features/multiple_files.feature
105
106
  - features/reference.feature
@@ -148,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
149
  version: 1.3.6
149
150
  requirements: []
150
151
  rubyforge_project: jekyll-scholar
151
- rubygems_version: 2.6.13
152
+ rubygems_version: 2.7.4
152
153
  signing_key:
153
154
  specification_version: 4
154
155
  summary: Jekyll extensions for the academic blogger.
@@ -163,6 +164,7 @@ test_files:
163
164
  - features/details.feature
164
165
  - features/filter.feature
165
166
  - features/grouping.feature
167
+ - features/interpolate.feature
166
168
  - features/layout.feature
167
169
  - features/multiple_files.feature
168
170
  - features/reference.feature