Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
caesr-pub
jekyll-scholar
Commits
fb78cb35
Commit
fb78cb35
authored
Jan 23, 2017
by
rmrf
Browse files
Have to push to repo
parent
fd1c3435
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
3 deletions
+67
-3
features/repository.feature
features/repository.feature
+49
-0
lib/jekyll/scholar/defaults.rb
lib/jekyll/scholar/defaults.rb
+3
-0
lib/jekyll/scholar/tags/bibliography.rb
lib/jekyll/scholar/tags/bibliography.rb
+1
-1
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+14
-2
No files found.
features/repository.feature
View file @
fb78cb35
...
...
@@ -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"
lib/jekyll/scholar/defaults.rb
View file @
fb78cb35
...
...
@@ -71,6 +71,9 @@ module Jekyll
'type_order'
=>
[],
'month_names'
=>
nil
,
# Delimiter for files in repositories for slides
'file_delimit'
=>
'_'
,
}.
freeze
class
<<
self
...
...
lib/jekyll/scholar/tags/bibliography.rb
View file @
fb78cb35
...
...
@@ -8,7 +8,7 @@ module Jekyll
super
@config
=
Scholar
.
defaults
.
dup
optparse
(
arguments
)
end
...
...
lib/jekyll/scholar/utilities.rb
View file @
fb78cb35
...
...
@@ -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,16 @@ 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'
]
puts
url
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
)]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment