jekyll-scholar 4.1.3 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/features/citation.feature +58 -0
- data/lib/jekyll/scholar/utilities.rb +13 -6
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 975325f5f0952b76b523cd83b8e087bdcc3fe0a0
|
4
|
+
data.tar.gz: 0f49f478269ced160ece93bd80c0c8b3fdaa51f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0455060d84b28ae533113bb7a086c54c7d52b87544bcc96a284bee1994f50e6cb73380b5b2009d657ea1038918e027a2ede9f3182b22ce5ce07b5f9446f44d36
|
7
|
+
data.tar.gz: 5074a8a3ddee8c3c808f55e70badd396b077d4ed59ca01293be19084eb15efcc27d639623657e3307b57f4146a719678a3ad241d3f9ebde50bef876fc5e37447
|
data/README.md
CHANGED
@@ -282,6 +282,14 @@ of the items you wish to quote separated by spaces. For example,
|
|
282
282
|
|
283
283
|
<a href="#ruby">(Flanagan & Matsumoto 2008; Shaughnessy 2013)</a>
|
284
284
|
|
285
|
+
#### Suppressing author names
|
286
|
+
|
287
|
+
Sometimes you want to suppress author names in a citation, because the
|
288
|
+
name has already been mentioned in your text; for such cases Jekyll-Scholar
|
289
|
+
provides the `--suppress_author` option (short form: `-A`):
|
290
|
+
`...as Matz explains {% cite ruby -A -l 42 %}` would produce something
|
291
|
+
like: `...as Matz explains (2008, p. 42)`.
|
292
|
+
|
285
293
|
#### Page numbers and locators
|
286
294
|
|
287
295
|
If you would like to add page numbers to your citation, you can use the
|
data/features/citation.feature
CHANGED
@@ -29,6 +29,34 @@ Feature: Citations
|
|
29
29
|
And the "_site/scholar.html" file should exist
|
30
30
|
And I should see "Flanagan" in "_site/scholar.html"
|
31
31
|
|
32
|
+
@tags @cite @suppress-author
|
33
|
+
Scenario: Citations With Suppressed Author
|
34
|
+
Given I have a scholar configuration with:
|
35
|
+
| key | value |
|
36
|
+
| source | ./_bibliography |
|
37
|
+
| bibliography | my_references |
|
38
|
+
And I have a "_bibliography" directory
|
39
|
+
And I have a file "_bibliography/my_references.bib":
|
40
|
+
"""
|
41
|
+
@book{ruby,
|
42
|
+
title = {The Ruby Programming Language},
|
43
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
44
|
+
year = {2008},
|
45
|
+
publisher = {O'Reilly Media}
|
46
|
+
}
|
47
|
+
"""
|
48
|
+
And I have a page "scholar.html":
|
49
|
+
"""
|
50
|
+
---
|
51
|
+
---
|
52
|
+
{% cite ruby --suppress_author %}
|
53
|
+
"""
|
54
|
+
When I run jekyll
|
55
|
+
Then the _site directory should exist
|
56
|
+
And the "_site/scholar.html" file should exist
|
57
|
+
And I should see "2008" in "_site/scholar.html"
|
58
|
+
And I should not see "Flanagan" in "_site/scholar.html"
|
59
|
+
|
32
60
|
@tags @cite
|
33
61
|
Scenario: Missing references
|
34
62
|
Given I have a scholar configuration with:
|
@@ -215,6 +243,36 @@ Feature: Citations
|
|
215
243
|
And the "_site/scholar.html" file should exist
|
216
244
|
And I should see "\[1\], \[2\]" in "_site/scholar.html"
|
217
245
|
|
246
|
+
@tags @cite @citation_number
|
247
|
+
Scenario: Multiple citations of the same item using citation numbers
|
248
|
+
Given I have a scholar configuration with:
|
249
|
+
| key | value |
|
250
|
+
| source | ./_bibliography |
|
251
|
+
| bibliography | my_references |
|
252
|
+
| style | ieee |
|
253
|
+
And I have a "_bibliography" directory
|
254
|
+
And I have a file "_bibliography/my_references.bib":
|
255
|
+
"""
|
256
|
+
@book{ruby,
|
257
|
+
title = {The Ruby Programming Language},
|
258
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
259
|
+
year = {2008},
|
260
|
+
publisher = {O'Reilly Media}
|
261
|
+
}
|
262
|
+
"""
|
263
|
+
And I have a page "scholar.html":
|
264
|
+
"""
|
265
|
+
---
|
266
|
+
---
|
267
|
+
{% cite ruby %}
|
268
|
+
{% cite ruby %}
|
269
|
+
"""
|
270
|
+
When I run jekyll
|
271
|
+
Then the _site directory should exist
|
272
|
+
And the "_site/scholar.html" file should exist
|
273
|
+
And I should see "\[1\]" in "_site/scholar.html"
|
274
|
+
And I should not see "\[2\]" in "_site/scholar.html"
|
275
|
+
|
218
276
|
@tags @cite @variables
|
219
277
|
Scenario: A Simple Citation using liquid variables
|
220
278
|
Given I have a scholar configuration with:
|
@@ -38,6 +38,10 @@ module Jekyll
|
|
38
38
|
@cited, @skip_sort = true, true
|
39
39
|
end
|
40
40
|
|
41
|
+
opts.on('-A', '--suppress_author') do |cited|
|
42
|
+
@suppress_author = true
|
43
|
+
end
|
44
|
+
|
41
45
|
opts.on('-f', '--file FILE') do |file|
|
42
46
|
@bibtex_files ||= []
|
43
47
|
@bibtex_files << file
|
@@ -72,7 +76,7 @@ module Jekyll
|
|
72
76
|
end
|
73
77
|
end
|
74
78
|
|
75
|
-
argv = arguments.split(/(\B-[
|
79
|
+
argv = arguments.split(/(\B-[cCfqptTslmA]|\B--(?:cited(_in_order)?|file|query|prefix|text|style|template|locator|max|suppress_author|))/)
|
76
80
|
|
77
81
|
parser.parse argv.map(&:strip).reject(&:empty?)
|
78
82
|
end
|
@@ -142,6 +146,10 @@ module Jekyll
|
|
142
146
|
sorted
|
143
147
|
end
|
144
148
|
|
149
|
+
def suppress_author?
|
150
|
+
!!@suppress_author
|
151
|
+
end
|
152
|
+
|
145
153
|
def repository?
|
146
154
|
!config['repository'].nil? && !config['repository'].empty?
|
147
155
|
end
|
@@ -322,7 +330,7 @@ module Jekyll
|
|
322
330
|
renderer.render items.zip(locators).map { |entry, locator|
|
323
331
|
cited_keys << entry.key
|
324
332
|
|
325
|
-
item = citation_item_for entry, citation_number
|
333
|
+
item = citation_item_for entry, citation_number(entry.key)
|
326
334
|
item.locator = locator
|
327
335
|
|
328
336
|
item
|
@@ -338,6 +346,7 @@ module Jekyll
|
|
338
346
|
CiteProc::CitationItem.new id: entry.id do |c|
|
339
347
|
c.data = CiteProc::Item.new entry.to_citeproc
|
340
348
|
c.data[:'citation-number'] = citation_number
|
349
|
+
c.data.suppress! 'author' if suppress_author?
|
341
350
|
end
|
342
351
|
end
|
343
352
|
|
@@ -345,10 +354,8 @@ module Jekyll
|
|
345
354
|
context['cited'] ||= []
|
346
355
|
end
|
347
356
|
|
348
|
-
def citation_number
|
349
|
-
|
350
|
-
context['citation_number'] = number.succ
|
351
|
-
number
|
357
|
+
def citation_number(key)
|
358
|
+
(context['citation_numbers'] ||= {})[key] ||= cited_keys.length
|
352
359
|
end
|
353
360
|
|
354
361
|
def cite(keys)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-scholar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|