jekyll-scholar 5.0.0.pre.1 → 5.0.0

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: c900b4242f9e31499231040ddf97470e84d1c081
4
- data.tar.gz: 1c8a78d9f26ab1f0dd3193c049d5ee2e27fcc848
3
+ metadata.gz: c1a9174d59f0edc15f40cf4b9add6ff620fdfb96
4
+ data.tar.gz: 67ae1aacef4d60a65bf1ed094fdb355da2a9081e
5
5
  SHA512:
6
- metadata.gz: 2c68e80076e577f5c34af42297f0fa86487805c5abbd9f556a1ca0b81cdbb7f87844910458ea40404f93fc3177710448e2bcc95c305c13aa5004fb71f591e08a
7
- data.tar.gz: a02ef361fc2ed975c7973d15158b60e824839235c0dd1e05567eab2138bf69c5fe31a5d2282e6d514d8c51054ee917af01a8af98d4f1825d381856a9deaf71f6
6
+ metadata.gz: 4c4fa55fe3ace0b47f34d079292f025967d9c8fea72fd925176286a8f7a215f8adfbf73ef46803ec8c2bfac698bde610acf977d2623c165a4c64ef3d724ff591
7
+ data.tar.gz: f68ca2a4f8bce0bfb77e5826a651577e2a35640662a47c0930b675621f69201fb4ba4b6e45dd62786ecf4c1e5c4874eec27d34ad42610a3111db6a7755c8e5fb
data/.travis.yml CHANGED
@@ -7,7 +7,6 @@ rvm:
7
7
  - 2.2.0
8
8
  - 2.1.0
9
9
  - 2.0.0
10
- - 1.9.3
11
10
  - rbx-2
12
11
  notifications:
13
12
  email:
data/README.md CHANGED
@@ -13,6 +13,8 @@ For additional features you may also want to take a look at
13
13
  [![Coverage Status](https://coveralls.io/repos/inukshuk/jekyll-scholar/badge.png)](https://coveralls.io/r/inukshuk/jekyll-scholar)
14
14
  [![Dependency Status](https://gemnasium.com/inukshuk/jekyll-scholar.png)](https://gemnasium.com/inukshuk/jekyll-scholar)
15
15
 
16
+ Already using Jekyll-Scholar and interested to help out? Please get in touch with us if you would like to become a maintainer!
17
+
16
18
  Installation
17
19
  ------------
18
20
 
@@ -106,7 +108,7 @@ It would be converted to `bibliography.html` with the following content:
106
108
  This makes it very easy for you to add your bibliography to your Jekyll-powered
107
109
  blog or website.
108
110
 
109
- If your using other converters to generate your site, don't worry, you can
111
+ If you are using other converters to generate your site, don't worry, you can
110
112
  still generate bibliographies using the `bibliography` tag. In your site
111
113
  or blog post, simply call:
112
114
 
@@ -182,7 +182,7 @@ Feature: Details
182
182
  Then the _site directory should exist
183
183
  And I should see "pretty" in "_config.yml"
184
184
  And the "_site/scholar/index.html" file should exist
185
- And I should see "<a[^>]+href=\"/bibliography/ruby/index.html\">" in "_site/scholar/index.html"
185
+ And I should see "<a[^>]+href=\"/bibliography/ruby/\">" in "_site/scholar/index.html"
186
186
  And the "_site/bibliography/ruby/index.html" file should exist
187
187
 
188
188
  @generators @parse_months
@@ -106,6 +106,40 @@ Feature: BibTeX
106
106
  And I should not see "Programming Ruby" in "_site/scholar.html"
107
107
  And I should see "The Ruby Programming Language" in "_site/scholar.html"
108
108
 
109
+ @tags @offset
110
+ Scenario: Start listing entries with an offset
111
+ Given I have a scholar configuration with:
112
+ | key | value |
113
+ | source | ./_bibliography |
114
+ And I have a "_bibliography" directory
115
+ And I have a file "_bibliography/references.bib":
116
+ """
117
+ @book{ruby,
118
+ title = {The Ruby Programming Language},
119
+ author = {Flanagan, David and Matsumoto, Yukihiro},
120
+ year = {2008},
121
+ publisher = {O'Reilly Media}
122
+ }
123
+ @book{pickaxe,
124
+ title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
125
+ author = {Thomas, Dave and Fowler, Chad and Hunt, Andy},
126
+ year = {2009},
127
+ edition = 3,
128
+ publisher = {Pragmatic Bookshelf}
129
+ }
130
+ """
131
+ And I have a page "scholar.html":
132
+ """
133
+ ---
134
+ ---
135
+ {% bibliography --offset 1 %}
136
+ """
137
+ When I run jekyll
138
+ Then the _site directory should exist
139
+ And the "_site/scholar.html" file should exist
140
+ And I should see "Programming Ruby" in "_site/scholar.html"
141
+ And I should not see "The Ruby Programming Language" in "_site/scholar.html"
142
+
109
143
  @tags @urls
110
144
  Scenario: URLs as text
111
145
  Given I have a scholar configuration with:
@@ -140,8 +174,8 @@ Feature: BibTeX
140
174
  | key | value |
141
175
  | source | ./_bibliography |
142
176
  And I have the following BibTeX filters:
143
- | latex |
144
177
  | markdown |
178
+ | latex |
145
179
  And I have a "_bibliography" directory
146
180
  And I have a file "_bibliography/references.bib":
147
181
  """
@@ -164,3 +198,33 @@ Feature: BibTeX
164
198
  Then the _site directory should exist
165
199
  And the "_site/scholar.html" file should exist
166
200
  And I should see "from \[https://pragprog.com\]\(https://pragprog.com\)" in "_site/scholar.html"
201
+
202
+ @tags @urls
203
+ Scenario: LaTeX links as Markdown links
204
+ Given I have a scholar configuration with:
205
+ | key | value |
206
+ | source | ./_bibliography |
207
+ And I have the following BibTeX filters:
208
+ | markdown |
209
+ | latex |
210
+ And I have a "_bibliography" directory
211
+ And I have a file "_bibliography/references.bib":
212
+ """
213
+ @book{pickaxe,
214
+ title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
215
+ author = {Thomas, Dave and Fowler, Chad and Hunt, Andy},
216
+ year = {2009},
217
+ edition = 3,
218
+ publisher = {\href\{https://pragprog.com\}\{Pragmatic Bookshelf\}},
219
+ }
220
+ """
221
+ And I have a page "scholar.html":
222
+ """
223
+ ---
224
+ ---
225
+ {% bibliography %}
226
+ """
227
+ When I run jekyll
228
+ Then the _site directory should exist
229
+ And the "_site/scholar.html" file should exist
230
+ And I should see "\[Pragmatic Bookshelf\]\(https://pragprog.com\)" in "_site/scholar.html"
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.required_rubygems_version = '>= 1.3.6'
26
26
  s.rubyforge_project = s.name
27
27
 
28
- s.add_runtime_dependency('jekyll', '>= 3.0.0.beta')
28
+ s.add_runtime_dependency('jekyll', '~> 3.0')
29
29
  s.add_runtime_dependency('citeproc-ruby', '~> 1.0')
30
30
  s.add_runtime_dependency('csl-styles', '~> 1.0')
31
31
  s.add_runtime_dependency('bibtex-ruby', '~> 4.0', '>= 4.0.13')
@@ -15,7 +15,7 @@ module Jekyll
15
15
  process(@name)
16
16
  read_yaml(File.join(base, '_layouts'), config['details_layout'])
17
17
 
18
- data['entry'] = liquidify(entry)
18
+ data.merge!(reference_data(entry))
19
19
  end
20
20
 
21
21
  end
@@ -1,13 +1,24 @@
1
- # Contriubted by @mfenner
1
+ # Contributed by @mfenner
2
2
  # See https://github.com/inukshuk/jekyll-scholar/issues/30
3
3
 
4
4
  require 'uri'
5
5
 
6
+ URL_PATTERN = Regexp.compile([
7
+ '\\\\href\\\\{([^\\\\}]+)\\\\}\\\\{([^\\\\}]+)\\\\}',
8
+ URI.regexp(['http', 'https', 'ftp'])
9
+ ].join('|'))
10
+
6
11
  module Jekyll
7
12
  class Scholar
8
13
  class Markdown < BibTeX::Filter
9
14
  def apply(value)
10
- value.to_s.gsub(URI.regexp(['http','https','ftp'])) { |c| "[#{$&}](#{$&})" }
15
+ value.to_s.gsub(URL_PATTERN) {
16
+ if $1
17
+ "[#{$2}](#{$1})"
18
+ else
19
+ "[#{$&}](#{$&})"
20
+ end
21
+ }
11
22
  end
12
23
  end
13
24
  end
@@ -15,6 +15,16 @@ module Jekyll
15
15
  def render(context)
16
16
  set_context_to context
17
17
 
18
+ # Add bibtex files to dependency tree
19
+ if context.registers[:page] and context.registers[:page].has_key? "path"
20
+ bibtex_paths.each do |bibtex_path|
21
+ site.regenerator.add_dependency(
22
+ site.in_source_dir(context.registers[:page]["path"]),
23
+ bibtex_path
24
+ )
25
+ end
26
+ end
27
+
18
28
  items = entries
19
29
 
20
30
  if cited_only?
@@ -32,7 +42,7 @@ module Jekyll
32
42
  cited_keys.clear
33
43
  end
34
44
 
35
- items = items.take(max.to_i) if limit_entries?
45
+ items = items[offset..max] if limit_entries?
36
46
 
37
47
  bibliography = items.each_with_index.map { |entry, index|
38
48
  reference = bibliography_tag(entry, index + 1)
@@ -5,7 +5,9 @@ module Jekyll
5
5
  # They should be thread safe as long as they are
6
6
  # treated as being read-only.
7
7
  STYLES = Hash.new do |h, k|
8
- h[k.to_s] = CSL::Style.load k
8
+ style = CSL::Style.load k
9
+ style = style.independent_parent unless style.independent?
10
+ h[k.to_s] = style
9
11
  end
10
12
 
11
13
 
@@ -14,7 +16,7 @@ module Jekyll
14
16
  # #site readers
15
17
  module Utilities
16
18
 
17
- attr_reader :config, :site, :context, :prefix, :text, :max
19
+ attr_reader :config, :site, :context, :prefix, :text, :offset, :max
18
20
 
19
21
  def split_arguments(arguments)
20
22
 
@@ -63,8 +65,12 @@ module Jekyll
63
65
  locators << locator
64
66
  end
65
67
 
68
+ opts.on('-o', '--offset OFFSET') do |offset|
69
+ @offset = offset.to_i
70
+ end
71
+
66
72
  opts.on('-m', '--max MAX') do |max|
67
- @max = max
73
+ @max = max.to_i
68
74
  end
69
75
 
70
76
  opts.on('-s', '--style STYLE') do |style|
@@ -76,7 +82,7 @@ module Jekyll
76
82
  end
77
83
  end
78
84
 
79
- argv = arguments.split(/(\B-[cCfqptTslmA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|max|suppress_author|))/)
85
+ argv = arguments.split(/(\B-[cCfqptTslomA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|offset|max|suppress_author|))/)
80
86
 
81
87
  parser.parse argv.map(&:strip).reject(&:empty?)
82
88
  end
@@ -135,8 +141,16 @@ module Jekyll
135
141
  sort bibliography[query || config['query']]
136
142
  end
137
143
 
144
+ def offset
145
+ @offset ||= 0
146
+ end
147
+
148
+ def max
149
+ @max.nil? ? -1 : @max + offset - 1
150
+ end
151
+
138
152
  def limit_entries?
139
- !max.nil?
153
+ !offset.nil? || !max.nil?
140
154
  end
141
155
 
142
156
  def sort(unsorted)
@@ -272,16 +286,22 @@ module Jekyll
272
286
  def bibliography_tag(entry, index)
273
287
  return missing_reference unless entry
274
288
 
275
- liquid_template.render({
289
+ liquid_template.render(
290
+ reference_data(entry,index).merge({
291
+ 'index' => index,
292
+ 'details' => details_link_for(entry)
293
+ }))
294
+ end
295
+
296
+ def reference_data(entry, index = nil)
297
+ {
276
298
  'entry' => liquidify(entry),
277
299
  'reference' => reference_tag(entry, index),
278
300
  'key' => entry.key,
279
301
  'type' => entry.type.to_s,
280
302
  'link' => repository_link_for(entry),
281
- 'links' => repository_links_for(entry),
282
- 'index' => index,
283
- 'details' => details_link_for(entry)
284
- })
303
+ 'links' => repository_links_for(entry)
304
+ }
285
305
  end
286
306
 
287
307
  def liquidify(entry)
@@ -323,7 +343,7 @@ module Jekyll
323
343
  name.gsub!(/[:\s]+/, '_')
324
344
 
325
345
  if site.config['permalink'] == 'pretty'
326
- name << '/index.html'
346
+ name << '/'
327
347
  else
328
348
  name << '.html'
329
349
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '5.0.0.pre.1'.freeze
3
+ VERSION = '5.0.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-scholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.pre.1
4
+ version: 5.0.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: 2015-08-12 00:00:00.000000000 Z
11
+ date: 2015-10-27 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
- version: 3.0.0.beta
19
+ version: '3.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
- version: 3.0.0.beta
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: citeproc-ruby
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: 1.3.6
140
140
  requirements: []
141
141
  rubyforge_project: jekyll-scholar
142
- rubygems_version: 2.4.7
142
+ rubygems_version: 2.4.5.1
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Jekyll extensions for the academic blogger.