jekyll-scholar 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 953182d6b21be19f9aaa67ac7212e36f977d3d8d
4
- data.tar.gz: 39fd7df236b9f05ff6393069b741ce68f09e802d
3
+ metadata.gz: 283d672bb247fb3d0acae3704b5b4309a25f708d
4
+ data.tar.gz: 1ae644d03d9eca66381959e740b42dc5e604b79c
5
5
  SHA512:
6
- metadata.gz: c1a9c763ddb481a6bede4db299aaf6938994d22c5b84c3be3c3b42ee0b936d5d1b384b50d14f43d22433c3edb88b8f6d643a228c9b3887b30833ec6a60b247d1
7
- data.tar.gz: 21db98dd52bc7655a8e5894922f0d849256e5eb82cfa521ea0ccfd4a9d77a2da209445ae57b9d21d94d328762dc3d60dbed894d4c96c4924eb7e3bdc712547d4
6
+ metadata.gz: 679b74e725f93ee3ac61667778e6324b88504eb50ea5461cb2f4778e509d5a4ccaaa43b23654100fdb24020971620241b68453603bd16a49be3c808ef3053684
7
+ data.tar.gz: 421510aa6e53b425ec10c8e8e5822acce8ad07a8b05e2d029e284dfcff444e6bd3d472415454be3eb843a8a7fc53cdc733a02844140758171881c4fcc940519a
data/README.md CHANGED
@@ -31,7 +31,7 @@ to a file in your plugin directory (e.g., to `_plugins/ext.rb`):
31
31
  Alternatively, add `jekyll-scholar` to your `gem` list in your Jekyll
32
32
  configuration:
33
33
 
34
- gem: ['jekyll-scholar']
34
+ gems: ['jekyll/scholar']
35
35
 
36
36
  In your configuration you can now adjust the Jekyll-Scholar settings. The
37
37
  default configuration is as follows:
@@ -152,6 +152,14 @@ For more details about filters, see the corresponding section below or
152
152
  consult the [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby)
153
153
  documentation.
154
154
 
155
+ If you need to limit the number of entries in your bibliography, you can
156
+ use the `--max` option:
157
+
158
+ {% bibliography --max 5 %}
159
+
160
+ This would generate a bibliography containing only the first 5 entries
161
+ of your bibliography (after query filters and sort options have been applied).
162
+
155
163
  ### Bibliography Template
156
164
 
157
165
  Your bibliography is always rendered as an ordered list. Additionally,
@@ -215,3 +215,30 @@ Feature: Citations
215
215
  And the "_site/scholar.html" file should exist
216
216
  And I should see "\[1\], \[2\]" in "_site/scholar.html"
217
217
 
218
+ @tags @cite @variables
219
+ Scenario: A Simple Citation using liquid variables
220
+ Given I have a scholar configuration with:
221
+ | key | value |
222
+ | source | ./_bibliography |
223
+ | bibliography | my_references |
224
+ And I have a "_bibliography" directory
225
+ And I have a file "_bibliography/my_references.bib":
226
+ """
227
+ @book{ruby,
228
+ title = {The Ruby Programming Language},
229
+ author = {Flanagan, David and Matsumoto, Yukihiro},
230
+ year = {2008},
231
+ publisher = {O'Reilly Media}
232
+ }
233
+ """
234
+ And I have a page "scholar.html":
235
+ """
236
+ ---
237
+ ---
238
+ {% assign myVariable = 'ruby' %}
239
+ {% cite myVariable %}
240
+ """
241
+ When I run jekyll
242
+ Then the _site directory should exist
243
+ And the "_site/scholar.html" file should exist
244
+ And I should see "Flanagan" in "_site/scholar.html"
@@ -37,3 +37,37 @@ Feature: BibTeX
37
37
  And the "_site/scholar.html" file should exist
38
38
  And I should see "Programming Ruby" in "_site/scholar.html"
39
39
  And I should not see "The Ruby Programming Language" in "_site/scholar.html"
40
+
41
+ @tags @max
42
+ Scenario: Limit number of entries
43
+ Given I have a scholar configuration with:
44
+ | key | value |
45
+ | source | ./_bibliography |
46
+ And I have a "_bibliography" directory
47
+ And I have a file "_bibliography/references.bib":
48
+ """
49
+ @book{ruby,
50
+ title = {The Ruby Programming Language},
51
+ author = {Flanagan, David and Matsumoto, Yukihiro},
52
+ year = {2008},
53
+ publisher = {O'Reilly Media}
54
+ }
55
+ @book{pickaxe,
56
+ title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
57
+ author = {Thomas, Dave and Fowler, Chad and Hunt, Andy},
58
+ year = {2009},
59
+ edition = 3,
60
+ publisher = {Pragmatic Bookshelf}
61
+ }
62
+ """
63
+ And I have a page "scholar.html":
64
+ """
65
+ ---
66
+ ---
67
+ {% bibliography --max 1 %}
68
+ """
69
+ When I run jekyll
70
+ Then the _site directory should exist
71
+ And the "_site/scholar.html" file should exist
72
+ And I should not see "Programming Ruby" in "_site/scholar.html"
73
+ And I should see "The Ruby Programming Language" in "_site/scholar.html"
@@ -21,6 +21,8 @@ module Jekyll
21
21
  cited_references.include? e.key
22
22
  end if cited_only?
23
23
 
24
+ references = references.take(max.to_i) if limit_entries?
25
+
24
26
  bibliography = references.each_with_index.map { |entry, index|
25
27
  reference = bibliography_tag(entry, index + 1)
26
28
 
@@ -15,7 +15,7 @@ module Jekyll
15
15
  module Utilities
16
16
 
17
17
  attr_reader :config, :site, :query,
18
- :context, :prefix, :keys, :text
18
+ :context, :prefix, :keys, :text, :max
19
19
 
20
20
  def split_arguments(arguments)
21
21
 
@@ -56,6 +56,10 @@ module Jekyll
56
56
  locators << locator
57
57
  end
58
58
 
59
+ opts.on('-m', '--max MAX') do |max|
60
+ @max = max
61
+ end
62
+
59
63
  opts.on('-s', '--style STYLE') do |style|
60
64
  @style = style
61
65
  end
@@ -65,7 +69,7 @@ module Jekyll
65
69
  end
66
70
  end
67
71
 
68
- argv = arguments.split(/(\B-[cfqptTsl]|\B--(?:cited|file|query|prefix|text|style|template|locator|))/)
72
+ argv = arguments.split(/(\B-[cfqptTslm]|\B--(?:cited|file|query|prefix|text|style|template|locator|max|))/)
69
73
 
70
74
  parser.parse argv.map(&:strip).reject(&:empty?)
71
75
  end
@@ -119,6 +123,10 @@ module Jekyll
119
123
  sort bibliography[query || config['query']]
120
124
  end
121
125
 
126
+ def limit_entries?
127
+ !max.nil?
128
+ end
129
+
122
130
  def sort(unsorted)
123
131
  return unsorted if config['sort_by'] == 'none'
124
132
 
@@ -319,6 +327,9 @@ module Jekyll
319
327
 
320
328
  def cite(keys)
321
329
  items = keys.map do |key|
330
+ # dereference variables in current scope
331
+ key = context.scopes.last[key] || key
332
+
322
333
  if bibliography.key?(key)
323
334
  entry = bibliography[key]
324
335
  entry = entry.convert(*bibtex_filters) unless bibtex_filters.empty?
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '4.0.0'.freeze
3
+ VERSION = '4.0.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,84 +1,84 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-scholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
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-05-15 00:00:00.000000000 Z
11
+ date: 2014-05-22 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: '2.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: '2.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: '1.0'
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: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: csl-styles
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.0'
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: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bibtex-ruby
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
- description: ' Jekyll-Scholar is for all the academic bloggers out there. It is a
69
+ description: " Jekyll-Scholar is for all the academic bloggers out there. It is a
70
70
  set of extensions for Jekyll the awesome, blog aware, static site generator; it
71
71
  formats your BibTeX bibliographies for the web using CSL citation styles and generally
72
- gives your blog posts citation super-powers.'' '
72
+ gives your blog posts citation super-powers.' "
73
73
  email: http://sylvester.keil.or.at
74
74
  executables: []
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - .coveralls.yml
79
- - .gitignore
80
- - .simplecov
81
- - .travis.yml
78
+ - ".coveralls.yml"
79
+ - ".gitignore"
80
+ - ".simplecov"
81
+ - ".travis.yml"
82
82
  - Gemfile
83
83
  - LICENSE
84
84
  - README.md
@@ -121,12 +121,12 @@ require_paths:
121
121
  - lib
122
122
  required_ruby_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - '>='
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.3.6
132
132
  requirements: []