jekyll-scholar 7.0.0 → 7.1.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: f0e78bd7c9317137c98678772de2dcc7299fcc02f44c9f425334100b87c2f369
4
- data.tar.gz: f78feb1a7fccce706830d2a3956bdbf0b3ec4245576e2b454492b20bb6832877
3
+ metadata.gz: ac1895a4efe7e09adee56f87d17f9b1ff555a9be15c5139a1e0bdc3f5845d5cb
4
+ data.tar.gz: 303fd1416949c484b16c54308cec9a9710724d12cabbafbd7c85913833537f7a
5
5
  SHA512:
6
- metadata.gz: d6ee7f7510ca466d16ec3112ed47df4bfc02d8a17b736ab323d5ee5ac77d523ab3083dccf073bdb328be397006b67230cf7d8fcff4aaae4e9d8095ddd1665dd5
7
- data.tar.gz: 5ea56025a3f93e3cbb3db96f81cc4bc7ffafa4524cdd53beec6b412b1c6d1fc331dc7b38c9d02e7704a89bc28dd51f4b377db8e97bc81805e1814a02deac1f21
6
+ metadata.gz: 35eaf9ac85b7ff25953ca2e485979f76f34198b46a919827f8723253adcc065dff092a6700de63ece08c79a17bf4540b36f73f3620810480c6756d21781f705e
7
+ data.tar.gz: cf324e39015123c0ee89e1f1f25511fd3eb23fd23d5d4e0fa09d6909eb923cee4b71fbe12ae2bd7a8b3dc81df6bf21006055aaf7b8c7d6b86784e58b42160248
data/README.md CHANGED
@@ -32,7 +32,7 @@ You can keep sources, configuration and plugins in a separate branch; see e.g.
32
32
  [here](http://davidensinger.com/2013/07/automating-jekyll-deployment-to-github-pages-with-rake/)
33
33
  for details.
34
34
 
35
-
35
+ Alternatively, you can use a [Github Actions](https://github.com/features/actions) called [jekyll-action](https://github.com/helaili/jekyll-action) to deploy your site to Github Pages
36
36
 
37
37
  Usage
38
38
  -----
@@ -0,0 +1,78 @@
1
+ Feature: Nocited Bibliographies
2
+ As a scholar who likes to blog
3
+ I want to sort my bibliography by hand
4
+ But do not want to cite anything
5
+
6
+ Scenario: Nocite references from a single bibliography
7
+ Given I have a scholar configuration with:
8
+ | key | value |
9
+ | source | ./_bibliography |
10
+ And I have a "_bibliography" directory
11
+ And I have a file "_bibliography/references.bib":
12
+ """
13
+ @book{ruby1,
14
+ title = {The Ruby Programming Language},
15
+ author = {Flanagan, David and Matsumoto, Yukihiro},
16
+ year = {2008},
17
+ publisher = {O'Reilly Media}
18
+ },
19
+ @book{ruby2,
20
+ title = {Ruby Not Cited},
21
+ author = {Flanagan, David and Matsumoto, Yukihiro},
22
+ year = {2007},
23
+ publisher = {O'Reilly Media}
24
+ },
25
+ @book{smalltalk,
26
+ title = {Smalltalk Best Practice Patterns},
27
+ author = {Kent Beck},
28
+ year = {1996},
29
+ publisher = {Prentice Hall}
30
+ }
31
+
32
+ """
33
+ And I have a page "scholar.html":
34
+ """
35
+ ---
36
+ ---
37
+ {% nocite smalltalk ruby1 %}
38
+ {% bibliography --cited %}
39
+ """
40
+ When I run jekyll
41
+ Then the _site directory should exist
42
+ And the "_site/scholar.html" file should exist
43
+ And I should see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
44
+ And I should see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
45
+ And I should not see "<i>Ruby Not Cited</i>" in "_site/scholar.html"
46
+
47
+ Scenario: No nocite references results in empty bibliography
48
+ Given I have a scholar configuration with:
49
+ | key | value |
50
+ | source | ./_bibliography |
51
+ And I have a "_bibliography" directory
52
+ And I have a file "_bibliography/references.bib":
53
+ """
54
+ @book{ruby,
55
+ title = {The Ruby Programming Language},
56
+ author = {Flanagan, David and Matsumoto, Yukihiro},
57
+ year = {2008},
58
+ publisher = {O'Reilly Media}
59
+ },
60
+ @book{smalltalk,
61
+ title = {Smalltalk Best Practice Patterns},
62
+ author = {Kent Beck},
63
+ year = {1996},
64
+ publisher = {Prentice Hall}
65
+ }
66
+
67
+ """
68
+ And I have a page "scholar.html":
69
+ """
70
+ ---
71
+ ---
72
+ {% bibliography --cited %}
73
+ """
74
+ When I run jekyll
75
+ Then the _site directory should exist
76
+ And the "_site/scholar.html" file should exist
77
+ And I should not see "<i>Smalltalk Best Practice Patterns</i>" in "_site/scholar.html"
78
+ And I should not see "<i>The Ruby Programming Language</i>" in "_site/scholar.html"
@@ -17,7 +17,7 @@ module Jekyll
17
17
 
18
18
  def initialize(config = {})
19
19
  super
20
- @config['scholar'] = Scholar.defaults.merge(@config['scholar'] || {})
20
+ @config = Scholar.defaults.merge(@config['scholar'] || {})
21
21
  @markdown = Jekyll::Converters::Markdown.new(config)
22
22
  end
23
23
 
@@ -31,7 +31,7 @@ module Jekyll
31
31
 
32
32
  def convert(content)
33
33
  content = BibTeX.parse(content, :strict => true, :include => [:meta_content],
34
- :filter => @config['scholar']['bibtex_filters']).map do |b|
34
+ :filter => config['bibtex_filters']).map do |b|
35
35
  if b.respond_to?(:to_citeproc)
36
36
  render_bibliography b
37
37
  else
@@ -0,0 +1,28 @@
1
+ module Jekyll
2
+ class Scholar
3
+
4
+ class NoCiteTag < Liquid::Tag
5
+ include Scholar::Utilities
6
+
7
+ attr_reader :pages
8
+
9
+ def initialize(tag_name, arguments, tokens)
10
+ super
11
+
12
+ @config = Scholar.defaults.dup
13
+ @keys, arguments = split_arguments(arguments)
14
+
15
+ optparse(arguments)
16
+ end
17
+
18
+ def render(context)
19
+ set_context_to context
20
+ nocite keys
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+ end
27
+
28
+ Liquid::Template.register_tag('nocite', Jekyll::Scholar::NoCiteTag)
@@ -384,7 +384,7 @@ module Jekyll
384
384
  def month_names
385
385
  return @month_names unless @month_names.nil?
386
386
 
387
- @month_names = config['month_names'].nil? ? Date::MONTHNAMES : config['month_names'].unshift(nil)
387
+ @month_names = config['month_names'].nil? ? Date::MONTHNAMES : [nil] + config['month_names']
388
388
  end
389
389
 
390
390
  def remove_duplicates?
@@ -656,7 +656,9 @@ module Jekyll
656
656
  end
657
657
 
658
658
  def base_url
659
- @base_url ||= site.config['baseurl'] || site.config['base_url'] || ''
659
+ @base_url ||= (
660
+ site.config['baseurl'] || site.config['base_url'] || ''
661
+ ).to_s
660
662
  end
661
663
 
662
664
  def details_path
@@ -731,6 +733,18 @@ module Jekyll
731
733
  link_to link_target_for(keys[0]), render_citation(items), {class: config['cite_class']}
732
734
  end
733
735
 
736
+ def nocite(keys)
737
+ items = keys.map do |key|
738
+ if bibliography.key?(key)
739
+ entry = bibliography[key]
740
+ cited_keys << entry.key
741
+ cited_keys.uniq!
742
+ else
743
+ return missing_reference
744
+ end
745
+ end
746
+ end
747
+
734
748
  def cite_details(key, text)
735
749
  if bibliography.key?(key)
736
750
  link_to details_link_for(bibliography[key]), text || config['details_link']
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  class Scholar
3
- VERSION = '7.0.0'.freeze
3
+ VERSION = '7.1.1'.freeze
4
4
  end
5
5
  end
@@ -18,6 +18,7 @@ require 'jekyll/scholar/tags/bibtex'
18
18
  require 'jekyll/scholar/tags/cite'
19
19
  require 'jekyll/scholar/tags/cite_details'
20
20
  require 'jekyll/scholar/tags/details_link'
21
+ require 'jekyll/scholar/tags/nocite'
21
22
  require 'jekyll/scholar/tags/quote'
22
23
  require 'jekyll/scholar/tags/reference'
23
24
  require 'jekyll/scholar/generators/details'
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: 7.0.0
4
+ version: 7.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-29 00:00:00.000000000 Z
11
+ date: 2022-10-17 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/nocite.feature
100
101
  - features/page_config.feature
101
102
  - features/reference.feature
102
103
  - features/removeduplicate.feature
@@ -127,6 +128,7 @@ files:
127
128
  - lib/jekyll/scholar/tags/cite.rb
128
129
  - lib/jekyll/scholar/tags/cite_details.rb
129
130
  - lib/jekyll/scholar/tags/details_link.rb
131
+ - lib/jekyll/scholar/tags/nocite.rb
130
132
  - lib/jekyll/scholar/tags/quote.rb
131
133
  - lib/jekyll/scholar/tags/reference.rb
132
134
  - lib/jekyll/scholar/utilities.rb
@@ -150,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
152
  - !ruby/object:Gem::Version
151
153
  version: 1.3.6
152
154
  requirements: []
153
- rubygems_version: 3.2.3
155
+ rubygems_version: 3.2.15
154
156
  signing_key:
155
157
  specification_version: 4
156
158
  summary: Jekyll extensions for the academic blogger.
@@ -168,6 +170,7 @@ test_files:
168
170
  - features/interpolate.feature
169
171
  - features/layout.feature
170
172
  - features/multiple_files.feature
173
+ - features/nocite.feature
171
174
  - features/page_config.feature
172
175
  - features/reference.feature
173
176
  - features/removeduplicate.feature