jekyll-scholar 4.0.5 → 4.1.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
2
  SHA1:
3
- metadata.gz: 854a3b6eb1db9fb5e669d6501d251e3efa8eacd0
4
- data.tar.gz: aaa908317ef5953921d7df4db8fe09c4f4c3eae8
3
+ metadata.gz: 3526ee5f1f1f511cb8af9059c0da3e82331ff87b
4
+ data.tar.gz: 147e99c0e375f097015d4fa527c04d565f8011ae
5
5
  SHA512:
6
- metadata.gz: 51bc9151f76818b473c960469e5d1ecbc552875aafb9faaabd06b0ebf4736d318a30225cda7e645b6da21891442bac2a12bae2fe526cdd9b7d8a5179ff40226d
7
- data.tar.gz: 3db13f1b2de1e4bac67c447a9d1ae23ac8d26e30b102768e9455de498cb8e918a75903dad18e55bdd9c7381f509894b9068eb025ad9aa5f72b0574c7a53da708
6
+ metadata.gz: cf53a90ba56215c0f4bd6bb5b68520766bdb7457f3f20f93b6de5668fc7d4840af3d49140cd558d09a2d10a3d0438be1e25cc227b76f318ab29c817cbe14bbb7
7
+ data.tar.gz: e2cc049bc9eb96dc9425ef5fa475d7f5b0c0c8de4a6311c3456e67bdaeb0a5dd27c1692921de4d0a127e3cf746ffcc16ced4ac96d591ba8d6bfef871cbde0dff
data/README.md CHANGED
@@ -379,12 +379,19 @@ Postscript files of your papers, you can use the configuration option
379
379
  `repository` to indicate this directory. When generating bibliographies,
380
380
  Jekyll-Scholar will look in that folder to see if it contains a filename
381
381
  matching each entry's BibTeX key: if it does, the path to that file
382
- will be exposed to the bibliography template.
382
+ will be exposed to the bibliography template as the `link` property.
383
+
384
+ Since version 4.1.0 repositories are not limited to PDF and PS files.
385
+ These files are mapped to the `links` property in your bibliography
386
+ template. Here is an example of template that utilizes this feature
387
+ to link to supporting material in a ZIP archive:
388
+
389
+ {{ reference }} [<a href="{{links.zip}}">Supporting Materials</a>]
383
390
 
384
391
  ### Detail Pages
385
392
 
386
393
  If your layouts directory contains a layout file for bibliography details
387
- (the 'details_layout' configuration options), Jekyll-Scholar will generate
394
+ (the `details_layout` configuration options), Jekyll-Scholar will generate
388
395
  a details page for each entry in you main bibliography. That is to say, if
389
396
  your bibliography contains the following entry:
390
397
 
@@ -437,8 +444,8 @@ configuration option. For example:
437
444
  query: "@book" #=> includes only books
438
445
  query: "@article[year>=2003]" #=> includes only articles published 2003 or later
439
446
  query: "@*[url]" #=> includes all entries with a url field
440
- query: "@*[status!=review]" #=> includes all entries whose status field is not set to 'review'
441
- query: "@book[year <= 1900 && author ^= Poe]" #=> Books published before 1900 where the author matches /Poe/
447
+ query: "@*[status!=review]" #=> includes all entries whose status field is not set to 'review'
448
+ query: "@book[year <= 1900 && author ^= Poe]" #=> Books published before 1900 where the author matches /Poe/
442
449
  query: "!@book" #=> includes all entries with a type other than book
443
450
 
444
451
  Please note that some of these queries require BibTeX-Ruby 2.3.0 or
@@ -63,6 +63,32 @@ Feature: BibTeX
63
63
  And the "_site/references.html" file should exist
64
64
  And I should see "Look, an umlaut: ü!" in "_site/references.html"
65
65
 
66
+ @tags @bibtex @wip
67
+ Scenario: Embedded BibTeX
68
+ Given I have a scholar configuration with:
69
+ | key | value |
70
+ | style | apa |
71
+ And I have a page "references.md":
72
+ """
73
+ ---
74
+ ---
75
+ References
76
+ ==========
77
+
78
+ {% bibtex %}
79
+ @book{ruby,
80
+ title = {The Ruby Programming Language},
81
+ author = {Flanagan, David and Matsumoto, Yukihiro},
82
+ year = {2008},
83
+ publisher = {O'Reilly Media}
84
+ }
85
+ {% endbibtex %}
86
+ """
87
+ When I run jekyll
88
+ Then the _site directory should exist
89
+ And the "_site/references.html" file should exist
90
+ And I should see "<i>The Ruby Programming Language</i>" in "_site/references.html"
91
+
66
92
  @tags
67
93
  Scenario: Simple Bibliography Loaded From Default Directory
68
94
  Given I have a scholar configuration with:
@@ -25,12 +25,16 @@ Feature: PDF Repository
25
25
  """
26
26
  The PDF
27
27
  """
28
+ And I have a file "papers/ruby.ppt":
29
+ """
30
+ The PPT
31
+ """
28
32
  And I have a "_layouts" directory
29
33
  And I have a file "_layouts/bibliography.html":
30
34
  """
31
35
  ---
32
36
  ---
33
- {{ reference }} Link: {{ link }}
37
+ {{ reference }} Link: {{ link }} Slides: {{ links.ppt }}
34
38
  """
35
39
  And I have a page "scholar.html":
36
40
  """
@@ -43,6 +47,7 @@ Feature: PDF Repository
43
47
  And the "_site/papers/ruby.pdf" file should exist
44
48
  And I should see "The Ruby Programming Language" in "_site/scholar.html"
45
49
  And I should see "Link: /papers/ruby.pdf" in "_site/scholar.html"
50
+ And I should see "Slides: /papers/ruby.ppt" in "_site/scholar.html"
46
51
 
47
52
 
48
53
 
@@ -13,6 +13,7 @@ require 'jekyll/scholar/utilities'
13
13
 
14
14
  require 'jekyll/scholar/converters/bibtex'
15
15
  require 'jekyll/scholar/tags/bibliography'
16
+ require 'jekyll/scholar/tags/bibtex'
16
17
  require 'jekyll/scholar/tags/cite'
17
18
  require 'jekyll/scholar/tags/cite_details'
18
19
  require 'jekyll/scholar/tags/quote'
@@ -0,0 +1,30 @@
1
+ module Jekyll
2
+ class Scholar
3
+
4
+ class BibTeXTag < Liquid::Block
5
+ include Scholar::Utilities
6
+
7
+ def initialize(tag_name, arguments, tokens)
8
+ super
9
+
10
+ @config = Scholar.defaults.dup
11
+ @keys, arguments = split_arguments arguments
12
+
13
+ optparse(arguments)
14
+ end
15
+
16
+ def render(context)
17
+ set_context_to context
18
+
19
+ BibTeX.parse(super, bibtex_options).map { |entry|
20
+ reference_tag entry
21
+
22
+ }.join("\n")
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+
29
+ Liquid::Template.register_tag('bibtex', Jekyll::Scholar::BibTeXTag)
30
+
@@ -151,11 +151,16 @@ module Jekyll
151
151
  end
152
152
 
153
153
  def load_repository
154
- return {} unless repository?
154
+ repo = Hash.new { |h,k| h[k] = {} }
155
155
 
156
- Hash[Dir[File.join(repository_path, '**/*.{pdf,ps}')].map { |path|
157
- [File.basename(path).sub(/\.(pdf|ps)$/, ''), path]
158
- }]
156
+ return repo unless repository?
157
+
158
+ Dir[File.join(repository_path, '**/*')].each do |path|
159
+ extname = File.extname(path)
160
+ repo[File.basename(path, extname)][extname[1..-1]] = path
161
+ end
162
+
163
+ repo
159
164
  end
160
165
 
161
166
  def repository_path
@@ -241,6 +246,7 @@ module Jekyll
241
246
  'key' => entry.key,
242
247
  'type' => entry.type.to_s,
243
248
  'link' => repository_link_for(entry),
249
+ 'links' => repository_links_for(entry),
244
250
  'index' => index,
245
251
  'details' => details_link_for(entry)
246
252
  })
@@ -281,12 +287,20 @@ module Jekyll
281
287
  end
282
288
 
283
289
  def repository_link_for(entry, base = base_url)
284
- url = repository[entry.key]
290
+ links = repository[entry.key]
291
+ url = links['pdf'] || links['ps']
292
+
285
293
  return unless url
286
294
 
287
295
  File.join(base, url)
288
296
  end
289
297
 
298
+ def repository_links_for(entry, base = base_url)
299
+ Hash[repository[entry.key].map { |ext, url|
300
+ [ext, File.join(base, url)]
301
+ }]
302
+ end
303
+
290
304
  def details_link_for(entry, base = base_url)
291
305
  File.join(base, details_path, details_file_for(entry))
292
306
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '4.0.5'.freeze
3
+ VERSION = '4.1.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: 4.0.5
4
+ version: 4.1.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: 2014-07-29 00:00:00.000000000 Z
11
+ date: 2014-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -105,6 +105,7 @@ files:
105
105
  - lib/jekyll/scholar/defaults.rb
106
106
  - lib/jekyll/scholar/generators/details.rb
107
107
  - lib/jekyll/scholar/tags/bibliography.rb
108
+ - lib/jekyll/scholar/tags/bibtex.rb
108
109
  - lib/jekyll/scholar/tags/cite.rb
109
110
  - lib/jekyll/scholar/tags/cite_details.rb
110
111
  - lib/jekyll/scholar/tags/quote.rb
@@ -131,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
132
  version: 1.3.6
132
133
  requirements: []
133
134
  rubyforge_project: jekyll-scholar
134
- rubygems_version: 2.2.2
135
+ rubygems_version: 2.1.8
135
136
  signing_key:
136
137
  specification_version: 4
137
138
  summary: Jekyll extensions for the academic blogger.