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
f8e83b19
Commit
f8e83b19
authored
Nov 16, 2014
by
Sylvester Keil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #66 citation numbers
parent
e30c4da9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
features/citation.feature
features/citation.feature
+30
-0
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+3
-5
No files found.
features/citation.feature
View file @
f8e83b19
...
...
@@ -215,6 +215,36 @@ Feature: Citations
And
the
"_site/scholar.html"
file should exist
And
I should see
"\[1\], \[2\]"
in
"_site/scholar.html"
@tags
@cite
@citation_number
Scenario
:
Multiple citations of the same item using citation numbers
Given I have a scholar configuration with
:
|
key
|
value
|
|
source
|
./_bibliography
|
|
bibliography
|
my_references
|
|
style
|
ieee
|
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"
:
"""
---
---
{% cite ruby %}
{% cite ruby %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should see
"\[1\]"
in
"_site/scholar.html"
And
I should not see
"\[2\]"
in
"_site/scholar.html"
@tags
@cite
@variables
Scenario
:
A
Simple Citation using liquid variables
Given I have a scholar configuration with
:
...
...
lib/jekyll/scholar/utilities.rb
View file @
f8e83b19
...
...
@@ -322,7 +322,7 @@ module Jekyll
renderer
.
render
items
.
zip
(
locators
).
map
{
|
entry
,
locator
|
cited_keys
<<
entry
.
key
item
=
citation_item_for
entry
,
citation_number
item
=
citation_item_for
entry
,
citation_number
(
entry
.
key
)
item
.
locator
=
locator
item
...
...
@@ -345,10 +345,8 @@ module Jekyll
context
[
'cited'
]
||=
[]
end
def
citation_number
number
=
context
[
'citation_number'
]
||
1
context
[
'citation_number'
]
=
number
.
succ
number
def
citation_number
(
key
)
(
context
[
'citation_numbers'
]
||=
{})[
key
]
||=
cited_keys
.
length
end
def
cite
(
keys
)
...
...
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