Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
caesr-pub
jekyll-scholar
Commits
4ef567dc
Commit
4ef567dc
authored
Feb 02, 2016
by
Sylvester Keil
Browse files
Merge pull request #130 from edgemaster/author_array
Export authors into an array under entry.author_array
parents
2932f98b
a2c59ac7
Changes
2
Hide whitespace changes
Inline
Side-by-side
features/bibtex.feature
View file @
4ef567dc
...
...
@@ -142,6 +142,33 @@ Feature: BibTeX
And
the
"_site/scholar.html"
file should exist
And
I should see
"<abbr>1 book \[ruby\]</abbr>Matsumoto"
in
"_site/scholar.html"
@tags
@bibliography
@config
@template
Scenario
:
Simple Bibliography With Custom Template
Given I have a scholar configuration with
:
|
key
|
value
|
|
source
|
./_bibliography
|
|
bibliography_template
|
<abbr>{{index}}
{{entry.type}}
[{{key}}]</abbr>{{entry.author_array[1].last}}
|
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 page "scholar.html"
:
"""
---
---
{% bibliography -f references %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should see
"<abbr>1 book \[ruby\]</abbr>Matsumoto"
in
"_site/scholar.html"
@tags
@filter
Scenario
:
Filtered Bibliography Loaded From Default Directory
Given I have a scholar configuration with
:
...
...
lib/jekyll/scholar/utilities.rb
View file @
4ef567dc
...
...
@@ -485,10 +485,14 @@ module Jekyll
e
[
key
.
to_s
]
=
value
.
to_s
if
value
.
is_a?
(
BibTeX
::
Names
)
e
[
"
#{
key
}
_array"
]
=
arr
=
[]
value
.
each
.
with_index
do
|
name
,
idx
|
parts
=
{}
name
.
each_pair
do
|
k
,
v
|
e
[
"
#{
key
}
_
#{
idx
}
_
#{
k
}
"
]
=
v
.
to_s
parts
[
k
.
to_s
]
=
v
.
to_s
end
arr
<<
parts
end
end
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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