jekyll-scholar 5.8.1 → 5.8.2

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: 5580ad167dd318d827b12d25b568b01a8839f695
4
- data.tar.gz: b222a4eacf852bbdcaccece79fafa83def744561
3
+ metadata.gz: 90dcebb42bbaea9a1c38409bf3ea692140b71a3a
4
+ data.tar.gz: 9d1acbf5ea85649e7b66ff78ce16dad1705ae859
5
5
  SHA512:
6
- metadata.gz: 170732689212bbde970ffb52030d545e1118f34ae49754fd34d43de7915c223db60e278a98d710f17b0f481165286dc9dd4d1acb204c9edf8df85700bba88e64
7
- data.tar.gz: 607485599c35cff2aed70356ea1c114cd4e54d099cdc521e6d888bc2c4807de4ac91cd8c40e2c7e7a213580c2340e4543f66a34876b6b4ea1825a4f7a8484ce6
6
+ metadata.gz: 3a29f85b19f3e733e80052a4c9012cfc4acafbf30ca446eb283c893309a76e50242e6ce068eab262ff07794531c4d11d171857b05bc6ef8168dd6c3403319d57
7
+ data.tar.gz: 074ef9f7336b289abd5c2a23199fddd8375fe2fd5d958cc2d77a078a99414addf47be33fa8a4edc3158407d83ea858bd079357651613c5db7b2e02bb3d98b317
@@ -49,5 +49,52 @@ Feature: PDF Repository
49
49
  And I should see "Link: /papers/ruby.pdf" in "_site/scholar.html"
50
50
  And I should see "Slides: /papers/ruby.ppt" in "_site/scholar.html"
51
51
 
52
-
53
-
52
+ @repository
53
+ Scenario: A bibliography with a single entry and a repository, with source directory set
54
+ Given I have a configuration file with:
55
+ | key | value |
56
+ | source | src |
57
+ And I have a scholar configuration with:
58
+ | key | value |
59
+ | source | _bibliography |
60
+ | repository | papers |
61
+ | bibliography_template | bibliography |
62
+ And I have a "src" directory
63
+ And I have a "src/_bibliography" directory
64
+ And I have a file "src/_bibliography/references.bib":
65
+ """
66
+ @book{ruby,
67
+ title = {The Ruby Programming Language},
68
+ author = {Flanagan, David and Matsumoto, Yukihiro},
69
+ year = {2008},
70
+ publisher = {O'Reilly Media}
71
+ }
72
+ """
73
+ And I have a "src/papers" directory
74
+ And I have a file "src/papers/ruby.pdf":
75
+ """
76
+ The PDF
77
+ """
78
+ And I have a file "src/papers/ruby.ppt":
79
+ """
80
+ The PPT
81
+ """
82
+ And I have a "src/_layouts" directory
83
+ And I have a file "src/_layouts/bibliography.html":
84
+ """
85
+ ---
86
+ ---
87
+ {{ reference }} Link: {{ link }} Slides: {{ links.ppt }}
88
+ """
89
+ And I have a page "src/scholar.html":
90
+ """
91
+ ---
92
+ ---
93
+ {% bibliography %}
94
+ """
95
+ When I run jekyll
96
+ Then the _site directory should exist
97
+ And I should see "The Ruby Programming Language" in "_site/scholar.html"
98
+ And the "_site/papers/ruby.pdf" file should exist
99
+ And I should see "Link: /papers/ruby.pdf" in "_site/scholar.html"
100
+ And I should see "Slides: /papers/ruby.ppt" in "_site/scholar.html"
@@ -21,13 +21,25 @@ require 'tmpdir'
21
21
 
22
22
  TEST_DIR = File.join(Dir.tmpdir, 'jekyll')
23
23
 
24
- def run_jekyll(options = {})
25
-
26
- options['source'] ||= TEST_DIR
27
- options['destination'] ||= File.join(TEST_DIR, '_site')
24
+ def prepend_test_dir(options, key)
25
+ if options.key?(key)
26
+ if Pathname(options[key]).relative?
27
+ options[key] = File.join(TEST_DIR, options[key])
28
+ end
29
+ else
30
+ options[key] ||= TEST_DIR
31
+ end
32
+ end
28
33
 
34
+ def run_jekyll(options = {})
35
+
29
36
  options = Jekyll.configuration(options)
30
37
 
38
+ prepend_test_dir(options, 'source')
39
+ prepend_test_dir(options, 'destination')
40
+
41
+ print options['source'] + "\n"
42
+ print options['destination'] + "\n"
31
43
  site = Jekyll::Site.new(options)
32
44
  site.process
33
45
 
@@ -351,10 +351,14 @@ module Jekyll
351
351
  repo = Hash.new { |h,k| h[k] = {} }
352
352
 
353
353
  return repo unless repository?
354
-
355
- Dir[File.join(repository_path, '**/*')].each do |path|
354
+
355
+ # ensure that the base directory format is literally
356
+ # the same as the entries that are in the directory
357
+ base = Dir[site.source][0]
358
+
359
+ Dir[File.join(site.source, repository_path, '**/*')].each do |path|
356
360
  extname = File.extname(path)
357
- repo[File.basename(path, extname)][extname[1..-1]] = path
361
+ repo[File.basename(path, extname)][extname[1..-1]] = Pathname(path).relative_path_from(Pathname(base))
358
362
  end
359
363
 
360
364
  repo
@@ -396,7 +400,7 @@ module Jekyll
396
400
 
397
401
  def scholar_source
398
402
  source = config['source']
399
-
403
+
400
404
  # Improve by using Pathname from stdlib?
401
405
  return source if source.start_with?('/') && File.exists?(source)
402
406
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '5.8.1'.freeze
3
+ VERSION = '5.8.2'.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.8.1
4
+ version: 5.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll