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
a4adcb40
Commit
a4adcb40
authored
Apr 25, 2016
by
Sylvester Keil
Browse files
Add locator label option
See #147
parent
12760b08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
features/citation.feature
features/citation.feature
+27
-0
lib/jekyll/scholar/utilities.rb
lib/jekyll/scholar/utilities.rb
+8
-2
No files found.
features/citation.feature
View file @
a4adcb40
...
...
@@ -235,6 +235,33 @@ Feature: Citations
And
the
"_site/scholar.html"
file should exist
And
I should see
"Matsumoto, 2008, pp. 2-3; Shaughnessy, 2013, pp. 23 & 42"
in
"_site/scholar.html"
@tags
@cite
@locator
@label
Scenario
:
Citations with locator labels
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"
:
"""
---
---
{% cite ruby --label chapter --locator 3 %}
"""
When
I run jekyll
Then
the _site directory should exist
And
the
"_site/scholar.html"
file should exist
And
I should see
"Flanagan & Matsumoto, 2008, chap. 3"
in
"_site/scholar.html"
@tags
@cite
@citation_number
Scenario
:
Multiple citations using citation numbers
Given I have a scholar configuration with
:
...
...
lib/jekyll/scholar/utilities.rb
View file @
a4adcb40
...
...
@@ -18,7 +18,8 @@ module Jekyll
module
Utilities
attr_reader
:config
,
:site
,
:context
,
:prefix
,
:text
,
:offset
,
:max
attr_reader
:config
,
:site
,
:context
,
:prefix
,
:text
,
:offset
,
:max
,
:label
...
...
@@ -69,6 +70,10 @@ module Jekyll
locators
<<
locator
end
opts
.
on
(
'-L'
,
'--label LABEL'
)
do
|
label
|
@label
=
label
end
opts
.
on
(
'-o'
,
'--offset OFFSET'
)
do
|
offset
|
@offset
=
offset
.
to_i
end
...
...
@@ -98,7 +103,7 @@ module Jekyll
end
end
argv
=
arguments
.
split
(
/(\B-[cCfqptTsgGOlomA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|group_(?:by|order)|type_order|template|locator|offset|max|suppress_author|))/
)
argv
=
arguments
.
split
(
/(\B-[cCfqptTsgGOl
L
omA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|group_(?:by|order)|type_order|template|locator|
label|
offset|max|suppress_author|))/
)
parser
.
parse
argv
.
map
(
&
:strip
).
reject
(
&
:empty?
)
end
...
...
@@ -569,6 +574,7 @@ module Jekyll
item
=
citation_item_for
entry
,
citation_number
(
entry
.
key
)
item
.
locator
=
locator
item
.
label
=
label
unless
label
.
nil?
item
},
STYLES
[
style
].
citation
...
...
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