Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
J
jekyll-scholar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
caesr-pub
jekyll-scholar
Commits
93257ead
Commit
93257ead
authored
Oct 05, 2014
by
Sylvester Keil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for multiple files in repository
see #59
parent
4868c178
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
10 deletions
+36
-10
README.md
README.md
+11
-4
features/repository.feature
features/repository.feature
+6
-1
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+19
-5
No files found.
README.md
View file @
93257ead
...
...
@@ -379,12 +379,19 @@ Postscript files of your papers, you can use the configuration option
`repository`
to indicate this directory. When generating bibliographies,
Jekyll-Scholar will look in that folder to see if it contains a filename
matching each entry's BibTeX key: if it does, the path to that file
will be exposed to the bibliography template.
will be exposed to the bibliography template as the
`link`
property.
Since version 4.1.0 repositories are not limited to PDF and PS files.
These files are mapped to the
`links`
property in your bibliography
template. Here is an example of template that utilizes this feature
to link to supporting material in a ZIP archive:
{{ reference }} [<a href="{{links.zip}}">Supporting Materials</a>]
### Detail Pages
If your layouts directory contains a layout file for bibliography details
(the
'details_layout'
configuration options), Jekyll-Scholar will generate
(the
`details_layout`
configuration options), Jekyll-Scholar will generate
a details page for each entry in you main bibliography. That is to say, if
your bibliography contains the following entry:
...
...
@@ -437,8 +444,8 @@ configuration option. For example:
query: "@book" #=> includes only books
query: "@article[year>=2003]" #=> includes only articles published 2003 or later
query: "@*[url]" #=> includes all entries with a url field
query: "@*[status!=review]" #=> includes all entries whose status field is not set to 'review'
query: "@book[year <= 1900 && author ^= Poe]" #=> Books published before 1900 where the author matches /Poe/
query: "@*[status!=review]" #=> includes all entries whose status field is not set to 'review'
query: "@book[year <= 1900 && author ^= Poe]" #=> Books published before 1900 where the author matches /Poe/
query: "!@book" #=> includes all entries with a type other than book
Please note that some of these queries require BibTeX-Ruby 2.3.0 or
...
...
features/repository.feature
View file @
93257ead
...
...
@@ -25,12 +25,16 @@ Feature: PDF Repository
"""
The PDF
"""
And I have a file "papers/ruby.ppt"
:
"""
The PPT
"""
And
I have a
"_layouts"
directory
And I have a file "_layouts/bibliography.html"
:
"""
---
---
{{ reference }} Link: {{ link }}
{{ reference }} Link: {{ link }}
Slides: {{ links.ppt }}
"""
And I have a page "scholar.html"
:
"""
...
...
@@ -43,6 +47,7 @@ Feature: PDF Repository
And
the
"_site/papers/ruby.pdf"
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.ppt"
in
"_site/scholar.html"
lib/jekyll/scholar/utilities.rb
View file @
93257ead
...
...
@@ -151,11 +151,16 @@ module Jekyll
end
def
load_repository
re
turn
{}
unless
repository?
re
po
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
{}
}
Hash
[
Dir
[
File
.
join
(
repository_path
,
'**/*.{pdf,ps}'
)].
map
{
|
path
|
[
File
.
basename
(
path
).
sub
(
/\.(pdf|ps)$/
,
''
),
path
]
}]
return
repo
unless
repository?
Dir
[
File
.
join
(
repository_path
,
'**/*'
)].
each
do
|
path
|
extname
=
File
.
extname
(
path
)
repo
[
File
.
basename
(
path
,
extname
)][
extname
[
1
..-
1
]]
=
path
end
repo
end
def
repository_path
...
...
@@ -241,6 +246,7 @@ module Jekyll
'key'
=>
entry
.
key
,
'type'
=>
entry
.
type
.
to_s
,
'link'
=>
repository_link_for
(
entry
),
'links'
=>
repository_links_for
(
entry
),
'index'
=>
index
,
'details'
=>
details_link_for
(
entry
)
})
...
...
@@ -281,12 +287,20 @@ module Jekyll
end
def
repository_link_for
(
entry
,
base
=
base_url
)
url
=
repository
[
entry
.
key
]
links
=
repository
[
entry
.
key
]
url
=
links
[
'pdf'
]
||
links
[
'ps'
]
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
)]
}]
end
def
details_link_for
(
entry
,
base
=
base_url
)
File
.
join
(
base
,
details_path
,
details_file_for
(
entry
))
end
...
...
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