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
d4ce19db
Commit
d4ce19db
authored
May 22, 2014
by
Sylvester Keil
Browse files
support variables in cite tag
parent
ed74394b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
features/citation.feature
features/citation.feature
+27
-0
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+3
-0
No files found.
features/citation.feature
View file @
d4ce19db
...
...
@@ -215,3 +215,30 @@ Feature: Citations
And
the
"_site/scholar.html"
file should exist
And
I should see
"\[1\], \[2\]"
in
"_site/scholar.html"
@tags
@cite
@variables
Scenario
:
A
Simple Citation using liquid variables
Given I have a scholar configuration with
:
|
key
|
value
|
|
source
|
./_bibliography
|
|
bibliography
|
my_references
|
And
I have a
"_bibliography"
directory
And I have a file "_bibliography/my_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"
:
"""
---
---
{% assign myVariable = 'ruby' %}
{% cite myVariable %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should see
"Flanagan"
in
"_site/scholar.html"
lib/jekyll/scholar/utilities.rb
View file @
d4ce19db
...
...
@@ -327,6 +327,9 @@ module Jekyll
def
cite
(
keys
)
items
=
keys
.
map
do
|
key
|
# dereference variables in current scope
key
=
context
.
scopes
.
last
[
key
]
||
key
if
bibliography
.
key?
(
key
)
entry
=
bibliography
[
key
]
entry
=
entry
.
convert
(
*
bibtex_filters
)
unless
bibtex_filters
.
empty?
...
...
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