jekyll-scholar 6.5.0 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/Gemfile +5 -5
- data/README.md +9 -1
- data/features/bibtex.feature +3 -2
- data/features/cite_details.feature +28 -0
- data/features/details.feature +3 -3
- data/features/filter.feature +38 -2
- data/features/page_config.feature +42 -0
- data/features/step_definitions/scholar_steps.rb +9 -0
- data/features/support/env.rb +2 -8
- data/features/support/hooks.rb +4 -2
- data/jekyll-scholar.gemspec +0 -1
- data/lib/jekyll/scholar.rb +1 -0
- data/lib/jekyll/scholar/defaults.rb +1 -0
- data/lib/jekyll/scholar/generators/details.rb +1 -1
- data/lib/jekyll/scholar/tags/bibliography.rb +1 -2
- data/lib/jekyll/scholar/tags/bibtex.rb +1 -5
- data/lib/jekyll/scholar/tags/details_link.rb +25 -0
- data/lib/jekyll/scholar/utilities.rb +49 -36
- data/lib/jekyll/scholar/version.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9003e905d46343a563b51568a93777e2fda49ede94e0cf34f0efc326eff8d6f8
|
4
|
+
data.tar.gz: cc3020a8bd67e1ae7e1a7d069b47c3ffa359dd22f003ab05e7ea15d3fcc66b34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d297673512e24ba530830d62ae7c3ff89a3a6360593f6bb0cda41ad93e4a64276576ed4d05d47283b66d6825ef9a399f970b01bc616eb5f3bf1aa83794a9978
|
7
|
+
data.tar.gz: 57901b71b3ac3c289b19d8c60167593a08928f6a2d8c9608456806e0bab8d5e22e181e2ba547fe9f9db8cbb5e76c0132e9c71205115454355829a7efe6787a9d
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,22 +2,22 @@ source 'https://rubygems.org'
|
|
2
2
|
gemspec
|
3
3
|
|
4
4
|
group :development do
|
5
|
-
gem '
|
5
|
+
gem 'cucumber'
|
6
6
|
gem 'rake'
|
7
|
+
gem 'redcarpet'
|
7
8
|
gem 'redgreen'
|
8
9
|
gem 'shoulda'
|
9
|
-
gem '
|
10
|
-
gem 'redcarpet'
|
10
|
+
gem 'test-unit'
|
11
11
|
gem 'unicode_utils' if RUBY_VERSION < '2.4'
|
12
12
|
end
|
13
13
|
|
14
14
|
group :extra do
|
15
|
-
|
15
|
+
gem 'listen'
|
16
16
|
end
|
17
17
|
|
18
18
|
group :coverage do
|
19
|
-
gem 'simplecov', :require => false
|
20
19
|
gem 'coveralls', :require => false
|
20
|
+
gem 'simplecov', :require => false
|
21
21
|
end
|
22
22
|
|
23
23
|
group :debug do
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Installation
|
|
18
18
|
|
19
19
|
Or add it to your `Gemfile`:
|
20
20
|
|
21
|
-
gem 'jekyll-scholar'
|
21
|
+
gem 'jekyll-scholar', group: :jekyll_plugins
|
22
22
|
|
23
23
|
### Github Pages
|
24
24
|
|
@@ -74,6 +74,7 @@ description of all options and their defaults, see
|
|
74
74
|
| `group_by` | `none` | Specifies how bibliography items are grouped. Grouping can be multi-level, e.g. `type, year` groups entries per publication type, and within those groups per year. |
|
75
75
|
| `group_order` | `ascending` | Ordering for groups is specified in the same way as the sort order. Publication types -- specified with group key `type`, can be ordered by adding `type_order` to the configuration. For example, `type_order: [article,techreport]` lists journal articles before technical reports. Types not mentioned in `type_order` are considered smaller than types that are mentioned. Types can be merge in one group using the `type_aliases` setting. By default `phdthesis` and `mastersthesis` are grouped as `thesis`. By using, for example, `type_aliases: { inproceedings: article}`, journal and conference articles appear in a single group. The display names for entry types are specified with `type_names`. Names for common types are provided, but they can be extended or overridden. For example, the default name for `article` is *Journal Articles*, but it can be changed to *Papers* using `type_names: { article: Papers }`. |
|
76
76
|
| `bibtex_filters` | `latex,smallcaps,superscript` | Configures which [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby) formatting filters values of entries should be passed through. The default `latex` filter converts LaTeX character escapes into unicode, `smallcaps` converts the `\textsc` command into a HTML `<font style=\"font-variant: small-caps\">` tag, and `superscript` which converts the `\textsuperscript` command into a HTML `<sup>` tag. |
|
77
|
+
| `raw_bibtex_filters` | ` ` | Configures which [BibTeX-Ruby](https://github.com/inukshuk/bibtex-ruby) formatting filters the raw BiBTeX entry (i.e. that available through `{{ entry.bibtex }}`) should be passed through. This can be used to e.g. strip excess newlines by using the `linebreaks` filter. |
|
77
78
|
|
78
79
|
|
79
80
|
### Bibliographies
|
@@ -501,6 +502,13 @@ can be set via the 'details_link' configuration option).
|
|
501
502
|
Duis 'aute irure dolor in reprehenderit in voluptate' velit esse cillum
|
502
503
|
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
503
504
|
proident {% cite_details key --text Click Here For More Details %}.
|
505
|
+
|
506
|
+
Alternatively, you can use the `details_link` tag to get just the URL to
|
507
|
+
a details page. This can be used to link to details pages in markdown the
|
508
|
+
same way you would link to a blog post with Jekyll's `link` tag.
|
509
|
+
|
510
|
+
[See our blog post]({% link _posts/2020-01-01-research-post.md %})
|
511
|
+
or [find more details]({% details_link key %}).
|
504
512
|
|
505
513
|
|
506
514
|
### Bibliography Filters
|
data/features/bibtex.feature
CHANGED
@@ -583,7 +583,7 @@ Feature: BibTeX
|
|
583
583
|
"""
|
584
584
|
---
|
585
585
|
---
|
586
|
-
{% bibliography %}
|
586
|
+
{% bibliography --style apa-6th-edition %}
|
587
587
|
"""
|
588
588
|
When I run jekyll
|
589
589
|
Then the _site directory should exist
|
@@ -619,7 +619,7 @@ Feature: BibTeX
|
|
619
619
|
Given I have a scholar configuration with:
|
620
620
|
| key | value |
|
621
621
|
| source | ./_bibliography |
|
622
|
-
| bibliography_template | <pre>{{entry.
|
622
|
+
| bibliography_template | <pre>{{entry.bibtex}}</pre> |
|
623
623
|
And I have a "_bibliography" directory
|
624
624
|
And I have a file "_bibliography/references.bib":
|
625
625
|
"""
|
@@ -638,3 +638,4 @@ Feature: BibTeX
|
|
638
638
|
Then the _site directory should exist
|
639
639
|
And the "_site/scholar.html" file should exist
|
640
640
|
And I should see "{{No Escape}}" in "_site/scholar.html"
|
641
|
+
And I should not see "raw" in "_site/scholar.html"
|
@@ -140,3 +140,31 @@ Feature: Citations
|
|
140
140
|
Then the _site directory should exist
|
141
141
|
And the "_site/scholar.html" file should exist
|
142
142
|
And I should see "Click For More</a>" in "_site/scholar.html"
|
143
|
+
|
144
|
+
@tags @details_link
|
145
|
+
Scenario: A Simple Details Link
|
146
|
+
Given I have a scholar configuration with:
|
147
|
+
| key | value |
|
148
|
+
| source | ./_bibliography |
|
149
|
+
| bibliography | my_references |
|
150
|
+
And I have a "_bibliography" directory
|
151
|
+
And I have a file "_bibliography/my_references.bib":
|
152
|
+
"""
|
153
|
+
@book{ruby,
|
154
|
+
title = {The Ruby Programming Language},
|
155
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
156
|
+
year = {2008},
|
157
|
+
publisher = {O'Reilly Media}
|
158
|
+
}
|
159
|
+
"""
|
160
|
+
And I have a page "scholar.html":
|
161
|
+
"""
|
162
|
+
---
|
163
|
+
---
|
164
|
+
{% details_link ruby %}
|
165
|
+
"""
|
166
|
+
When I run jekyll
|
167
|
+
Then the _site directory should exist
|
168
|
+
And the "_site/scholar.html" file should exist
|
169
|
+
And I should see "/bibliography/ruby.html" in "_site/scholar.html"
|
170
|
+
And I should not see ""<a>"" in "_site/scholar.html"
|
data/features/details.feature
CHANGED
@@ -107,7 +107,7 @@ Feature: Details
|
|
107
107
|
And I should see "Page title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html"
|
108
108
|
And I should see "Title: An Umlaut \\\"a!" in "_site/bibliography/ruby.html"
|
109
109
|
And I should see "title = {An Umlaut \\\"a!}" in "_site/bibliography/ruby.html"
|
110
|
-
|
110
|
+
|
111
111
|
|
112
112
|
@generators
|
113
113
|
Scenario: Liquid tags should not be parsed inside the bibtex
|
@@ -438,8 +438,8 @@ Feature: Details
|
|
438
438
|
And the "_site/scholar/index.html" file should exist
|
439
439
|
And I should see "<a[^>]+href=\"/blog/bibliography/2008/10.0000/1111/\">" in "_site/scholar/index.html"
|
440
440
|
And I should see "<a[^>]+href=\"/blog/bibliography/2018/ruby/\">" in "_site/scholar/index.html"
|
441
|
-
And the "_site/
|
442
|
-
And the "_site/
|
441
|
+
And the "_site/bibliography/2008/10.0000/1111/index.html" file should exist
|
442
|
+
And the "_site/bibliography/2018/ruby/index.html" file should exist
|
443
443
|
|
444
444
|
@generators @parse_months
|
445
445
|
Scenario: Months are parsed by default
|
data/features/filter.feature
CHANGED
@@ -161,7 +161,7 @@ Feature: BibTeX
|
|
161
161
|
"""
|
162
162
|
---
|
163
163
|
---
|
164
|
-
{% bibliography %}
|
164
|
+
{% bibliography --style apa-6th-edition %}
|
165
165
|
"""
|
166
166
|
When I run jekyll
|
167
167
|
Then the _site directory should exist
|
@@ -192,7 +192,7 @@ Feature: BibTeX
|
|
192
192
|
"""
|
193
193
|
---
|
194
194
|
---
|
195
|
-
{% bibliography %}
|
195
|
+
{% bibliography --style apa-6th-edition %}
|
196
196
|
"""
|
197
197
|
When I run jekyll
|
198
198
|
Then the _site directory should exist
|
@@ -609,3 +609,39 @@ Feature: BibTeX
|
|
609
609
|
And the "_site/scholar.html" file should exist
|
610
610
|
And I should see "This is <span class="tiny">i is tiny</span> to me." in "_site/scholar.html"
|
611
611
|
|
612
|
+
@tags @filters
|
613
|
+
Scenario: Apply raw BiBTeX filters
|
614
|
+
Given I have a scholar configuration with:
|
615
|
+
| key | value |
|
616
|
+
| source | ./_bibliography |
|
617
|
+
| bibliography_template | bibliography |
|
618
|
+
And I have the following raw BibTeX filters:
|
619
|
+
| linebreaks |
|
620
|
+
And I have a "_bibliography" directory
|
621
|
+
And I have a file "_bibliography/references.bib":
|
622
|
+
"""
|
623
|
+
@misc{pickaxe,
|
624
|
+
title = {Long
|
625
|
+
line},
|
626
|
+
series = {Longer
|
627
|
+
line}
|
628
|
+
}
|
629
|
+
"""
|
630
|
+
And I have a "_layouts" directory
|
631
|
+
And I have a file "_layouts/bibliography.html":
|
632
|
+
"""
|
633
|
+
---
|
634
|
+
---
|
635
|
+
{{ entry.bibtex }}
|
636
|
+
"""
|
637
|
+
And I have a page "scholar.html":
|
638
|
+
"""
|
639
|
+
---
|
640
|
+
---
|
641
|
+
{% bibliography %}
|
642
|
+
"""
|
643
|
+
When I run jekyll
|
644
|
+
Then the _site directory should exist
|
645
|
+
And the "_site/scholar.html" file should exist
|
646
|
+
And I should see "@misc{pickaxe,\n title = {Long line},\n series = {Longer line}" in "_site/scholar.html"
|
647
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Page Configuration
|
2
|
+
As a scholar who likes to blog
|
3
|
+
I want to set local jekyll-scholar options per page
|
4
|
+
In order to override the global config
|
5
|
+
|
6
|
+
@tags @filters
|
7
|
+
Scenario: Filter by Year
|
8
|
+
Given I have a scholar configuration with:
|
9
|
+
| key | value |
|
10
|
+
| source | ./_bibliography |
|
11
|
+
| query | "@*[year=2009]" |
|
12
|
+
And I have a "_bibliography" directory
|
13
|
+
And I have a file "_bibliography/references.bib":
|
14
|
+
"""
|
15
|
+
@book{ruby,
|
16
|
+
title = {The Ruby Programming Language},
|
17
|
+
author = {Flanagan, David and Matsumoto, Yukihiro},
|
18
|
+
year = {2008},
|
19
|
+
publisher = {O'Reilly Media}
|
20
|
+
}
|
21
|
+
@book{pickaxe,
|
22
|
+
title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide},
|
23
|
+
author = {Thomas, Dave and Fowler, Chad and Hunt, Andy},
|
24
|
+
year = {2009},
|
25
|
+
edition = 3,
|
26
|
+
publisher = {Pragmatic Bookshelf}
|
27
|
+
}
|
28
|
+
"""
|
29
|
+
And I have a page "scholar.html":
|
30
|
+
"""
|
31
|
+
---
|
32
|
+
scholar:
|
33
|
+
query: "@*[year=2008]"
|
34
|
+
---
|
35
|
+
{% bibliography %}
|
36
|
+
"""
|
37
|
+
When I run jekyll
|
38
|
+
Then the _site directory should exist
|
39
|
+
And the "_site/scholar.html" file should exist
|
40
|
+
And I should see "The Ruby Programming Language" in "_site/scholar.html"
|
41
|
+
And I should not see "Programming Ruby" in "_site/scholar.html"
|
42
|
+
|
@@ -36,6 +36,15 @@ Given(/^I have the following BibTeX filters:$/) do |table|
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
Given(/^I have the following raw BibTeX filters:$/) do |table|
|
40
|
+
File.open('_config.yml', 'a') do |f|
|
41
|
+
f.write(" raw_bibtex_filters:\n")
|
42
|
+
table.raw.flatten.each do |row|
|
43
|
+
f.write(" - #{row}\n")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
39
48
|
Then(/^"(.*)" should come before "(.*)" in "(.*)"$/) do |p1, p2, file|
|
40
49
|
data = File.open(file).readlines.join('')
|
41
50
|
|
data/features/support/env.rb
CHANGED
@@ -6,16 +6,12 @@ rescue LoadError
|
|
6
6
|
end
|
7
7
|
|
8
8
|
begin
|
9
|
-
|
10
|
-
require 'byebug'
|
11
|
-
else
|
12
|
-
require 'debugger'
|
13
|
-
end
|
9
|
+
require 'byebug'
|
14
10
|
rescue LoadError
|
15
11
|
# ignore
|
16
12
|
end
|
17
13
|
|
18
|
-
require 'test
|
14
|
+
require 'minitest/test'
|
19
15
|
require 'jekyll/scholar'
|
20
16
|
require 'tmpdir'
|
21
17
|
|
@@ -32,7 +28,6 @@ def prepend_test_dir(options, key)
|
|
32
28
|
end
|
33
29
|
|
34
30
|
def run_jekyll(options = {})
|
35
|
-
|
36
31
|
options = Jekyll.configuration(options)
|
37
32
|
|
38
33
|
prepend_test_dir(options, 'source')
|
@@ -42,5 +37,4 @@ def run_jekyll(options = {})
|
|
42
37
|
print options['destination'] + "\n"
|
43
38
|
site = Jekyll::Site.new(options)
|
44
39
|
site.process
|
45
|
-
|
46
40
|
end
|
data/features/support/hooks.rb
CHANGED
data/jekyll-scholar.gemspec
CHANGED
data/lib/jekyll/scholar.rb
CHANGED
@@ -17,6 +17,7 @@ require 'jekyll/scholar/tags/bibliography_count'
|
|
17
17
|
require 'jekyll/scholar/tags/bibtex'
|
18
18
|
require 'jekyll/scholar/tags/cite'
|
19
19
|
require 'jekyll/scholar/tags/cite_details'
|
20
|
+
require 'jekyll/scholar/tags/details_link'
|
20
21
|
require 'jekyll/scholar/tags/quote'
|
21
22
|
require 'jekyll/scholar/tags/reference'
|
22
23
|
require 'jekyll/scholar/generators/details'
|
@@ -37,6 +37,7 @@ module Jekyll
|
|
37
37
|
|
38
38
|
'bibtex_options' => { :strip => false, :parse_months => true },
|
39
39
|
'bibtex_filters' => [ :smallcaps, :superscript, :italics, :textit, :lowercase, :textregistered, :tiny, :latex ],
|
40
|
+
'raw_bibtex_filters' => [ ],
|
40
41
|
'bibtex_skip_fields' => [ :abstract, :month_numeric ],
|
41
42
|
'bibtex_quotes' => ['{', '}'],
|
42
43
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Jekyll
|
2
2
|
class Scholar
|
3
|
-
|
4
3
|
class BibliographyTag < Liquid::Tag
|
5
4
|
include Scholar::Utilities
|
6
5
|
|
@@ -34,7 +33,7 @@ module Jekyll
|
|
34
33
|
def render_groups(groups)
|
35
34
|
def group_renderer(groupsOrItems,keys,order,tags)
|
36
35
|
if keys.count == 0
|
37
|
-
|
36
|
+
csl_renderer(true)
|
38
37
|
render_items(groupsOrItems)
|
39
38
|
else
|
40
39
|
groupsOrItems
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Jekyll
|
2
2
|
class Scholar
|
3
|
-
|
4
3
|
class BibTeXTag < Liquid::Block
|
5
4
|
include Scholar::Utilities
|
6
5
|
|
@@ -15,16 +14,13 @@ module Jekyll
|
|
15
14
|
|
16
15
|
def render(context)
|
17
16
|
set_context_to context
|
18
|
-
|
17
|
+
|
19
18
|
BibTeX.parse(super, bibtex_options).map { |entry|
|
20
19
|
reference_tag entry
|
21
|
-
|
22
20
|
}.join("\n")
|
23
21
|
end
|
24
22
|
end
|
25
|
-
|
26
23
|
end
|
27
24
|
end
|
28
25
|
|
29
26
|
Liquid::Template.register_tag('bibtex', Jekyll::Scholar::BibTeXTag)
|
30
|
-
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class Scholar
|
3
|
+
|
4
|
+
class DetailsLinkTag < Liquid::Tag
|
5
|
+
include Scholar::Utilities
|
6
|
+
|
7
|
+
def initialize(tag_name, arguments, tokens)
|
8
|
+
super
|
9
|
+
|
10
|
+
@config = Scholar.defaults.dup
|
11
|
+
@keys, arguments = split_arguments arguments
|
12
|
+
|
13
|
+
optparse(arguments)
|
14
|
+
end
|
15
|
+
|
16
|
+
def render(context)
|
17
|
+
set_context_to context
|
18
|
+
details_link keys[0]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Liquid::Template.register_tag('details_link', Jekyll::Scholar::DetailsLinkTag)
|
@@ -165,6 +165,10 @@ module Jekyll
|
|
165
165
|
config['bibtex_filters'] ||= []
|
166
166
|
end
|
167
167
|
|
168
|
+
def raw_bibtex_filters
|
169
|
+
config['raw_bibtex_filters'] ||= []
|
170
|
+
end
|
171
|
+
|
168
172
|
def bibtex_paths
|
169
173
|
bibtex_files.map { |file|
|
170
174
|
interpolated_file = interpolate file
|
@@ -518,7 +522,7 @@ module Jekyll
|
|
518
522
|
def bibliography_tag(entry, index)
|
519
523
|
return missing_reference unless entry
|
520
524
|
|
521
|
-
|
525
|
+
liquid_template.render(
|
522
526
|
reference_data(entry,index)
|
523
527
|
.merge(site.site_payload)
|
524
528
|
.merge({
|
@@ -528,17 +532,7 @@ module Jekyll
|
|
528
532
|
{
|
529
533
|
:registers => { :site => site },
|
530
534
|
:filters => [Jekyll::Filters]
|
531
|
-
}
|
532
|
-
)
|
533
|
-
# process the generated reference with Liquid, to get the same behaviour as
|
534
|
-
# when it is used on a page
|
535
|
-
Liquid::Template.parse(tmp).render(
|
536
|
-
site.site_payload,
|
537
|
-
{
|
538
|
-
:registers => { :site => site },
|
539
|
-
:filters => [Jekyll::Filters]
|
540
|
-
}
|
541
|
-
)
|
535
|
+
})
|
542
536
|
end
|
543
537
|
|
544
538
|
def reference_data(entry, index = nil)
|
@@ -558,8 +552,13 @@ module Jekyll
|
|
558
552
|
e['key'] = entry.key
|
559
553
|
e['type'] = entry.type.to_s
|
560
554
|
|
555
|
+
conv_opts = { quotes: config['bibtex_quotes'] }
|
556
|
+
if !raw_bibtex_filters.empty?
|
557
|
+
conv_opts[:filter] = *raw_bibtex_filters
|
558
|
+
end
|
559
|
+
|
561
560
|
if entry.field_names(config['bibtex_skip_fields']).empty?
|
562
|
-
e['bibtex'] = entry.to_s(
|
561
|
+
e['bibtex'] = entry.to_s(conv_opts)
|
563
562
|
else
|
564
563
|
tmp = entry.dup
|
565
564
|
|
@@ -567,10 +566,10 @@ module Jekyll
|
|
567
566
|
tmp.delete name if tmp.field?(name)
|
568
567
|
end
|
569
568
|
|
570
|
-
e['bibtex'] = tmp.to_s(
|
569
|
+
e['bibtex'] = tmp.to_s(conv_opts)
|
571
570
|
end
|
572
571
|
|
573
|
-
e['raw_bibtex'] = "{%raw%}#{e['bibtex']}{%endraw%}"
|
572
|
+
#e['raw_bibtex'] = "{%raw%}#{e['bibtex']}{%endraw%}"
|
574
573
|
|
575
574
|
entry.fields.each do |key, value|
|
576
575
|
value = value.convert(*bibtex_filters) unless bibtex_filters.empty?
|
@@ -616,6 +615,10 @@ module Jekyll
|
|
616
615
|
end
|
617
616
|
|
618
617
|
def details_link_for(entry, base = base_url)
|
618
|
+
File.join(base, details_path_for(entry))
|
619
|
+
end
|
620
|
+
|
621
|
+
def details_path_for(entry)
|
619
622
|
# Expand the details_permalink template into the complete URL for this entry.
|
620
623
|
|
621
624
|
# First generate placeholders for all items in the bibtex entry
|
@@ -625,29 +628,30 @@ module Jekyll
|
|
625
628
|
value = Jekyll::Utils::slugify(value, :mode => 'pretty') unless k == :doi
|
626
629
|
url_placeholders[k] = value
|
627
630
|
end
|
628
|
-
# Maintain the same URLs are previous versions of jekyll-scholar
|
629
|
-
# processed the key.
|
631
|
+
# Maintain the same URLs are previous versions of jekyll-scholar
|
632
|
+
# by replicating the way that it processed the key.
|
630
633
|
url_placeholders[:key] = entry.key.to_s.gsub(/[:\s]+/, '_')
|
631
634
|
url_placeholders[:details_dir] = details_path
|
632
|
-
|
633
|
-
#
|
635
|
+
|
636
|
+
# Autodetect the appropriate file extension based upon the site config,
|
637
|
+
# using the same rules as previous versions of jekyll-scholar. Users can
|
638
|
+
# override these settings by defining a details_permalink
|
634
639
|
# without the :extension field.
|
635
640
|
if (site.config['permalink'] == 'pretty') || (site.config['permalink'].end_with? '/')
|
636
641
|
url_placeholders[:extension] = '/'
|
637
642
|
else
|
638
643
|
url_placeholders[:extension] = '.html'
|
639
644
|
end
|
640
|
-
|
645
|
+
|
646
|
+
# Overwrite 'doi' key with the citation key if DOI field is empty or missing
|
641
647
|
if !entry.has_field?('doi') || entry.doi.empty?
|
642
648
|
url_placeholders[:doi] = url_placeholders[:key]
|
643
649
|
end
|
644
650
|
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
:placeholders => url_placeholders
|
650
|
-
).to_s)
|
651
|
+
URL.new(
|
652
|
+
template: config['details_permalink'],
|
653
|
+
placeholders: url_placeholders
|
654
|
+
).to_s
|
651
655
|
end
|
652
656
|
|
653
657
|
def base_url
|
@@ -658,15 +662,15 @@ module Jekyll
|
|
658
662
|
config['details_dir']
|
659
663
|
end
|
660
664
|
|
661
|
-
def
|
662
|
-
return @
|
665
|
+
def csl_renderer(force = false)
|
666
|
+
return @csl_renderer if @csl_renderer && !force
|
663
667
|
|
664
|
-
@
|
668
|
+
@csl_renderer = CiteProc::Ruby::Renderer.new :format => 'html',
|
665
669
|
:style => style, :locale => config['locale']
|
666
670
|
end
|
667
671
|
|
668
672
|
def render_citation(items)
|
669
|
-
|
673
|
+
csl_renderer.render items.zip(locators.zip(labels)).map { |entry, (locator, label)|
|
670
674
|
cited_keys << entry.key
|
671
675
|
cited_keys.uniq!
|
672
676
|
|
@@ -680,17 +684,17 @@ module Jekyll
|
|
680
684
|
|
681
685
|
def render_bibliography(entry, index = nil)
|
682
686
|
begin
|
683
|
-
original_locale
|
684
|
-
|
687
|
+
original_locale = csl_renderer.locale
|
688
|
+
csl_renderer.locale = locales(entry.language)
|
685
689
|
rescue
|
686
690
|
# Locale failed to load; just use original one!
|
687
691
|
end if allow_locale_overrides? &&
|
688
|
-
|
692
|
+
entry['language'] != csl_renderer.locale.language
|
689
693
|
|
690
|
-
|
694
|
+
csl_renderer.render citation_item_for(entry, index),
|
691
695
|
styles(style).bibliography
|
692
696
|
ensure
|
693
|
-
|
697
|
+
csl_renderer.locale = original_locale unless original_locale.nil?
|
694
698
|
end
|
695
699
|
|
696
700
|
def citation_item_for(entry, citation_number = nil)
|
@@ -734,6 +738,14 @@ module Jekyll
|
|
734
738
|
end
|
735
739
|
end
|
736
740
|
|
741
|
+
def details_link(key)
|
742
|
+
if bibliography.key?(key)
|
743
|
+
details_link_for(bibliography[key])
|
744
|
+
else
|
745
|
+
raise Exception.new "Could not find entry for key '%s'" % key
|
746
|
+
end
|
747
|
+
end
|
748
|
+
|
737
749
|
def content_tag(name, content_or_attributes, attributes = {})
|
738
750
|
if content_or_attributes.is_a?(Hash)
|
739
751
|
content, attributes = nil, content_or_attributes
|
@@ -776,8 +788,9 @@ module Jekyll
|
|
776
788
|
end
|
777
789
|
|
778
790
|
def set_context_to(context)
|
779
|
-
@context, @site, = context, context.registers
|
791
|
+
@context, @site, page, = context, *context.registers.values_at(:site, :page)
|
780
792
|
config.merge!(site.config['scholar'] || {})
|
793
|
+
config.merge!(page['scholar'] || {})
|
781
794
|
self
|
782
795
|
end
|
783
796
|
|
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: 6.
|
4
|
+
version: 6.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- features/interpolate.feature
|
98
98
|
- features/layout.feature
|
99
99
|
- features/multiple_files.feature
|
100
|
+
- features/page_config.feature
|
100
101
|
- features/reference.feature
|
101
102
|
- features/removeduplicate.feature
|
102
103
|
- features/repository.feature
|
@@ -125,6 +126,7 @@ files:
|
|
125
126
|
- lib/jekyll/scholar/tags/bibtex.rb
|
126
127
|
- lib/jekyll/scholar/tags/cite.rb
|
127
128
|
- lib/jekyll/scholar/tags/cite_details.rb
|
129
|
+
- lib/jekyll/scholar/tags/details_link.rb
|
128
130
|
- lib/jekyll/scholar/tags/quote.rb
|
129
131
|
- lib/jekyll/scholar/tags/reference.rb
|
130
132
|
- lib/jekyll/scholar/utilities.rb
|
@@ -133,7 +135,7 @@ homepage: http://github.com/inukshuk/jekyll-scholar
|
|
133
135
|
licenses:
|
134
136
|
- MIT
|
135
137
|
metadata: {}
|
136
|
-
post_install_message:
|
138
|
+
post_install_message:
|
137
139
|
rdoc_options: []
|
138
140
|
require_paths:
|
139
141
|
- lib
|
@@ -148,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
150
|
- !ruby/object:Gem::Version
|
149
151
|
version: 1.3.6
|
150
152
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
-
signing_key:
|
153
|
+
rubygems_version: 3.1.2
|
154
|
+
signing_key:
|
153
155
|
specification_version: 4
|
154
156
|
summary: Jekyll extensions for the academic blogger.
|
155
157
|
test_files:
|
@@ -166,6 +168,7 @@ test_files:
|
|
166
168
|
- features/interpolate.feature
|
167
169
|
- features/layout.feature
|
168
170
|
- features/multiple_files.feature
|
171
|
+
- features/page_config.feature
|
169
172
|
- features/reference.feature
|
170
173
|
- features/removeduplicate.feature
|
171
174
|
- features/repository.feature
|