jekyll-scholar 6.5.1 → 6.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69721f8d8ba934874039c43bd0fab2ec7c5ab4dda4be6d0758e331c333466207
4
- data.tar.gz: 52a3b972483b9626789ff4cba5b4203d411e17cd659d0f2c3e74f8239da0d532
3
+ metadata.gz: c9346570d30eece29b417704f8763a9469f87102f032e935eac75d9ad210fdcc
4
+ data.tar.gz: 477d15d2b49bca506ce249391bc4aef547a5ed1da6d20d4a1cbb93d48e264cd8
5
5
  SHA512:
6
- metadata.gz: afe07db8a50178374c677d9a4252c4eda8f84e71b6c212d7382443ab5217614eafea901ec41fd5c3e28b7b6ca495f020980e2b8780c7c2a1e86d53ac672369ea
7
- data.tar.gz: f80f88409839f68ff4c3b06ba78f7a0df99a40e970711ec318a1053ae456bf60214e0209886424620030b874f4ca48d4d1600de6b96a4cc0f079876b12347df5
6
+ metadata.gz: 762c7394574ee27561d12e6a7d70a2c52994e79faffc7ea055cad29fd0f44e281b35dbf4545e7791ce92b6255c4ee766bb6c1a4f2500e87798f1b9625ead1466
7
+ data.tar.gz: '009e6399ff632b7e92a2676aedec967c586b2c2dd46fdf16f78094a4edf0d066d26834633b7f715f998239f360b6bd8eb601840081cec5c3bffc8fd4e5a58557'
data/.travis.yml CHANGED
@@ -3,8 +3,10 @@ sudo: false
3
3
  cache: bundler
4
4
  matrix:
5
5
  include:
6
- - rvm: 2.6
6
+ - rvm: 2.7
7
7
  env: WITH_COVERALLS=true
8
+ - rvm: 2.6
9
+ env: WITH_COVERALLS=false
8
10
  - rvm: 2.5
9
11
  env: WITH_COVERALLS=false
10
12
  - rvm: 2.4
data/Gemfile CHANGED
@@ -2,22 +2,22 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  group :development do
5
- gem 'test-unit'
5
+ gem 'cucumber'
6
6
  gem 'rake'
7
+ gem 'redcarpet'
7
8
  gem 'redgreen'
8
9
  gem 'shoulda'
9
- gem 'cucumber', '1.3.11'
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
- gem 'listen'
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
 
@@ -53,10 +53,10 @@ configuration:
53
53
 
54
54
  In your Jekyll configuration file you can adjust the Jekyll-Scholar settings
55
55
  using the `scholar` key. For example, the following sets the bibliography style
56
- to `mla`.
56
+ to `modern-language-association`.
57
57
 
58
58
  scholar:
59
- style: mla
59
+ style: modern-language-association
60
60
 
61
61
  The table below describes some commonly used configuration options. For a
62
62
  description of all options and their defaults, see
@@ -64,7 +64,7 @@ description of all options and their defaults, see
64
64
 
65
65
  | Option | Default | Description |
66
66
  |--------|---------|-------------|
67
- | `style` | `apa` | Indicates the style used for the bibliography and citations. You can use any style that ships with [CiteProc-Ruby](https://github.com/inukshuk/citeproc-ruby) by name (e.g., apa, mla, chicago-fullnote-bibliography) which is usually the filename as seen [here](https://github.com/citation-style-language/styles) without the `.csl` ending; note that you have to use `dependent/style` if you want to use one from that directory. Alternatively you can add a link to any CSL style (e.g., you could link to any of the styles available at the official [CSL style repository](https://github.com/citation-style-language/styles)). |
67
+ | `style` | `apa` | Indicates the style used for the bibliography and citations. You can use any style that ships with [CiteProc-Ruby](https://github.com/inukshuk/citeproc-ruby) by name (e.g., apa, chicago-fullnote-bibliography) which is usually the filename as seen [here](https://github.com/citation-style-language/styles) without the `.csl` ending; note that you have to use `dependent/style` if you want to use one from that directory. Alternatively you can add a link to any CSL style (e.g., you could link to any of the styles available at the official [CSL style repository](https://github.com/citation-style-language/styles)). |
68
68
  | `locale` | `en` | Defines what language to use when formatting your references (this typically applies to localized terms, e.g., 'Eds.' for editors in English). |
69
69
  | `source` | `./_bibliography` | Indicates where your bibliographies are stored. |
70
70
  | `bibliography` | `references.bib` | Indicates the name of your default bibliography. For best results, please ensure that your bibliography is encoded as ASCII or UTF-8. A string that contains a `*` will be passed to `Dir::glob`, so `**/*.bib{,tex}` will find all files named `*.bib` and `*.bibtex` under `source`. |
@@ -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
@@ -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
@@ -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"
@@ -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/blog/bibliography/2008/10.0000/1111/index.html" file should exist
442
- And the "_site/blog/bibliography/2018/ruby/index.html" file should exist
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
@@ -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,72 @@
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
+
43
+
44
+ @tags
45
+ Scenario: Template access to page config
46
+ Given I have a scholar configuration with:
47
+ | key | value |
48
+ | source | ./_bibliography |
49
+ | bibliography_template | <p>{{page.scholar.x}}</p> |
50
+ And I have a "_bibliography" directory
51
+ And I have a file "_bibliography/references.bib":
52
+ """
53
+ @book{ruby,
54
+ title = {The Ruby Programming Language},
55
+ author = {Flanagan, David and Matsumoto, Yukihiro},
56
+ year = {2008},
57
+ publisher = {O'Reilly Media}
58
+ }
59
+ """
60
+ And I have a page "scholar.html":
61
+ """
62
+ ---
63
+ scholar:
64
+ x: Asa-Nisi-Masa
65
+ ---
66
+ {% bibliography %}
67
+ """
68
+ When I run jekyll
69
+ Then the _site directory should exist
70
+ And the "_site/scholar.html" file should exist
71
+ And I should see "<p>Asa-Nisi-Masa</p>" in "_site/scholar.html"
72
+
@@ -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
 
@@ -6,16 +6,12 @@ rescue LoadError
6
6
  end
7
7
 
8
8
  begin
9
- if RUBY_VERSION > '2.0'
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/unit'
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
@@ -5,6 +5,8 @@ Before do
5
5
  end
6
6
 
7
7
  After do
8
- FileUtils.rm_rf(TEST_DIR) if File.exist?(TEST_DIR)
8
+ if File.exist?(TEST_DIR)
9
+ FileUtils.rm_rf(TEST_DIR)
10
+ Dir.chdir(File.dirname(TEST_DIR))
11
+ end
9
12
  end
10
-
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.date = Time.now
24
24
 
25
25
  s.required_rubygems_version = '>= 1.3.6'
26
- s.rubyforge_project = s.name
27
26
 
28
27
  s.add_runtime_dependency('jekyll', '~> 4.0')
29
28
  s.add_runtime_dependency('citeproc-ruby', '~> 1.0')
@@ -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
 
@@ -23,7 +23,7 @@ module Jekyll
23
23
 
24
24
  def url
25
25
  # Reuse the logic in the utilities module for deciding URLs
26
- details_link_for(@entry)
26
+ details_path_for(@entry)
27
27
  end
28
28
  end
29
29
 
@@ -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
- renderer(true)
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
@@ -523,10 +527,11 @@ module Jekyll
523
527
  .merge(site.site_payload)
524
528
  .merge({
525
529
  'index' => index,
530
+ 'page' => context.registers[:page],
526
531
  'details' => details_link_for(entry)
527
532
  }),
528
533
  {
529
- :registers => { :site => site },
534
+ :registers => context.registers,
530
535
  :filters => [Jekyll::Filters]
531
536
  })
532
537
  end
@@ -548,8 +553,13 @@ module Jekyll
548
553
  e['key'] = entry.key
549
554
  e['type'] = entry.type.to_s
550
555
 
556
+ conv_opts = { quotes: config['bibtex_quotes'] }
557
+ if !raw_bibtex_filters.empty?
558
+ conv_opts[:filter] = *raw_bibtex_filters
559
+ end
560
+
551
561
  if entry.field_names(config['bibtex_skip_fields']).empty?
552
- e['bibtex'] = entry.to_s({ quotes: config['bibtex_quotes'] })
562
+ e['bibtex'] = entry.to_s(conv_opts)
553
563
  else
554
564
  tmp = entry.dup
555
565
 
@@ -557,7 +567,7 @@ module Jekyll
557
567
  tmp.delete name if tmp.field?(name)
558
568
  end
559
569
 
560
- e['bibtex'] = tmp.to_s({ quotes: config['bibtex_quotes'] })
570
+ e['bibtex'] = tmp.to_s(conv_opts)
561
571
  end
562
572
 
563
573
  #e['raw_bibtex'] = "{%raw%}#{e['bibtex']}{%endraw%}"
@@ -606,6 +616,10 @@ module Jekyll
606
616
  end
607
617
 
608
618
  def details_link_for(entry, base = base_url)
619
+ File.join(base, details_path_for(entry))
620
+ end
621
+
622
+ def details_path_for(entry)
609
623
  # Expand the details_permalink template into the complete URL for this entry.
610
624
 
611
625
  # First generate placeholders for all items in the bibtex entry
@@ -615,29 +629,30 @@ module Jekyll
615
629
  value = Jekyll::Utils::slugify(value, :mode => 'pretty') unless k == :doi
616
630
  url_placeholders[k] = value
617
631
  end
618
- # Maintain the same URLs are previous versions of jekyll-scholar by replicating the way that it
619
- # processed the key.
632
+ # Maintain the same URLs are previous versions of jekyll-scholar
633
+ # by replicating the way that it processed the key.
620
634
  url_placeholders[:key] = entry.key.to_s.gsub(/[:\s]+/, '_')
621
635
  url_placeholders[:details_dir] = details_path
622
- # Autodetect the appropriate file extension based upon the site config, using the same rules as
623
- # previous versions of jekyll-scholar. Uses can override these settings by defining a details_permalink
636
+
637
+ # Autodetect the appropriate file extension based upon the site config,
638
+ # using the same rules as previous versions of jekyll-scholar. Users can
639
+ # override these settings by defining a details_permalink
624
640
  # without the :extension field.
625
641
  if (site.config['permalink'] == 'pretty') || (site.config['permalink'].end_with? '/')
626
642
  url_placeholders[:extension] = '/'
627
643
  else
628
644
  url_placeholders[:extension] = '.html'
629
645
  end
630
- # Overwrite the 'doi' key with the citation key if the DOI field is empty or missing
646
+
647
+ # Overwrite 'doi' key with the citation key if DOI field is empty or missing
631
648
  if !entry.has_field?('doi') || entry.doi.empty?
632
649
  url_placeholders[:doi] = url_placeholders[:key]
633
650
  end
634
651
 
635
- # generate the URL
636
- File.join(base,
637
- URL.new(
638
- :template => config['details_permalink'],
639
- :placeholders => url_placeholders
640
- ).to_s)
652
+ URL.new(
653
+ template: config['details_permalink'],
654
+ placeholders: url_placeholders
655
+ ).to_s
641
656
  end
642
657
 
643
658
  def base_url
@@ -648,15 +663,15 @@ module Jekyll
648
663
  config['details_dir']
649
664
  end
650
665
 
651
- def renderer(force = false)
652
- return @renderer if @renderer && !force
666
+ def csl_renderer(force = false)
667
+ return @csl_renderer if @csl_renderer && !force
653
668
 
654
- @renderer = CiteProc::Ruby::Renderer.new :format => 'html',
669
+ @csl_renderer = CiteProc::Ruby::Renderer.new :format => 'html',
655
670
  :style => style, :locale => config['locale']
656
671
  end
657
672
 
658
673
  def render_citation(items)
659
- renderer.render items.zip(locators.zip(labels)).map { |entry, (locator, label)|
674
+ csl_renderer.render items.zip(locators.zip(labels)).map { |entry, (locator, label)|
660
675
  cited_keys << entry.key
661
676
  cited_keys.uniq!
662
677
 
@@ -670,17 +685,17 @@ module Jekyll
670
685
 
671
686
  def render_bibliography(entry, index = nil)
672
687
  begin
673
- original_locale, renderer.locale =
674
- renderer.locale, locales(entry.language)
688
+ original_locale = csl_renderer.locale
689
+ csl_renderer.locale = locales(entry.language)
675
690
  rescue
676
691
  # Locale failed to load; just use original one!
677
692
  end if allow_locale_overrides? &&
678
- entry['language'] != renderer.locale.language
693
+ entry['language'] != csl_renderer.locale.language
679
694
 
680
- renderer.render citation_item_for(entry, index),
695
+ csl_renderer.render citation_item_for(entry, index),
681
696
  styles(style).bibliography
682
697
  ensure
683
- renderer.locale = original_locale unless original_locale.nil?
698
+ csl_renderer.locale = original_locale unless original_locale.nil?
684
699
  end
685
700
 
686
701
  def citation_item_for(entry, citation_number = nil)
@@ -724,6 +739,14 @@ module Jekyll
724
739
  end
725
740
  end
726
741
 
742
+ def details_link(key)
743
+ if bibliography.key?(key)
744
+ details_link_for(bibliography[key])
745
+ else
746
+ raise Exception.new "Could not find entry for key '%s'" % key
747
+ end
748
+ end
749
+
727
750
  def content_tag(name, content_or_attributes, attributes = {})
728
751
  if content_or_attributes.is_a?(Hash)
729
752
  content, attributes = nil, content_or_attributes
@@ -766,8 +789,9 @@ module Jekyll
766
789
  end
767
790
 
768
791
  def set_context_to(context)
769
- @context, @site, = context, context.registers[:site]
792
+ @context, @site, page, = context, *context.registers.values_at(:site, :page)
770
793
  config.merge!(site.config['scholar'] || {})
794
+ config.merge!(page['scholar'] || {})
771
795
  self
772
796
  end
773
797
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '6.5.1'.freeze
3
+ VERSION = '6.8.1'.freeze
4
4
  end
5
5
  end
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.5.1
4
+ version: 6.8.1
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: 2019-11-22 00:00:00.000000000 Z
11
+ date: 2021-03-23 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.0.6
152
- signing_key:
153
+ rubygems_version: 3.2.3
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