Commit a4adcb40 by Sylvester Keil

Add locator label option

See #147
parent 12760b08
......@@ -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:
......
......@@ -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-[cCfqptTsgGOlLomA]|\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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment