Commit 926b5a7d by rmrf

Merge with 5.9.0 version

parents fa70c0fd 9fcbe22e
......@@ -8,7 +8,7 @@ module Jekyll
super
@config = Scholar.defaults.dup
optparse(arguments)
end
......
diff --git a/features/repository.feature b/features/repository.feature
index 3c4da7c..c88067a 100644
--- a/features/repository.feature
+++ b/features/repository.feature
@@ -98,3 +98,52 @@ Feature: PDF Repository
And the "_site/papers/ruby.pdf" file should exist
And I should see "Link: /papers/ruby.pdf" in "_site/scholar.html"
And I should see "Slides: /papers/ruby.ppt" in "_site/scholar.html"
+
+ @repository
+ Scenario: A bibliography with a single entry and a repository with slides pdf
+ Given I have a scholar configuration with:
+ | key | value |
+ | source | ./_bibliography |
+ | repository | papers |
+ | bibliography_template | bibliography |
+ | file_delimit | '.' |
+
+ And I have a "_bibliography" directory
+ And I have a file "_bibliography/references.bib":
+ """
+ @book{ruby,
+ title = {The Ruby Programming Language},
+ author = {Flanagan, David and Matsumoto, Yukihiro},
+ year = {2008},
+ publisher = {O'Reilly Media}
+ }
+ """
+ And I have a "papers" directory
+ And I have a file "papers/ruby.pdf":
+ """
+ The PDF
+ """
+ And I have a file "papers/ruby.slides.ppt":
+ """
+ The PPT
+ """
+ And I have a "_layouts" directory
+ And I have a file "_layouts/bibliography.html":
+ """
+ ---
+ ---
+ {{ reference }} Link: {{ link }} Slides: {{ link_slides }}
+ """
+ And I have a page "scholar.html":
+ """
+ ---
+ ---
+ {% bibliography %}
+ """
+ When I run jekyll
+ Then the _site directory should exist
+ And the "_site/papers/ruby.pdf" file should exist
+ And the "_site/papers/ruby.slides.ppt" file should exist
+ And I should see "The Ruby Programming Language" in "_site/scholar.html"
+ And I should see "Link: /papers/ruby.pdf" in "_site/scholar.html"
+ And I should see "Slides: /papers/ruby.slides.ppt" in "_site/scholar.html"
diff --git a/lib/jekyll/scholar/defaults.rb b/lib/jekyll/scholar/defaults.rb
index 78f77e5..ce28cc6 100644
--- a/lib/jekyll/scholar/defaults.rb
+++ b/lib/jekyll/scholar/defaults.rb
@@ -71,6 +71,9 @@ module Jekyll
'type_order' => [],
'month_names' => nil,
+ # Delimiter for files in repositories for slides
+ 'file_delimit' => '_',
+
}.freeze
class << self
diff --git a/lib/jekyll/scholar/tags/bibliography.rb b/lib/jekyll/scholar/tags/bibliography.rb
index 700bbb6..53822cc 100644
--- a/lib/jekyll/scholar/tags/bibliography.rb
+++ b/lib/jekyll/scholar/tags/bibliography.rb
@@ -8,7 +8,7 @@ module Jekyll
super
@config = Scholar.defaults.dup
-
+
optparse(arguments)
end
diff --git a/lib/jekyll/scholar/utilities.rb b/lib/jekyll/scholar/utilities.rb
index 1b74235..abd414b 100644
--- a/lib/jekyll/scholar/utilities.rb
+++ b/lib/jekyll/scholar/utilities.rb
@@ -239,6 +239,7 @@ module Jekyll
grouper(ungrouped, group_keys, group_order)
end
+
def group_keys
return @group_keys unless @group_keys.nil?
@@ -312,7 +313,7 @@ module Jekyll
value.to_s
end
end
-
+
def type_order
@type_order ||= config['type_order']
end
@@ -486,7 +487,8 @@ module Jekyll
'key' => entry.key,
'type' => entry.type.to_s,
'link' => repository_link_for(entry),
- 'links' => repository_links_for(entry)
+ 'links' => repository_links_for(entry),
+ 'link_slides' => repository_link_slides_for(entry)
}
end
@@ -557,6 +559,15 @@ module Jekyll
File.join(base, url)
end
+ def repository_link_slides_for(entry, base = base_url)
+ links = repository[entry.key + config['file_delimit'] + "slides"]
+ url = links['pdf'] || links['ps'] || links['pptx'] || links['ppt']
+ return unless url
+
+ File.join(base, url)
+ end
+
+
def repository_links_for(entry, base = base_url)
Hash[repository[entry.key].map { |ext, url|
[ext, File.join(base, url)]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment