jekyll-scholar 7.0.0 → 7.1.0

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: 287c638fa9bd7e062280db1af05a5d98cc9d509c423ce1b8d0f7d948f3498b16
4
+ data.tar.gz: 606db44855a017a7694b61560ef7779c95118f461301298e7875bc1fbf5d2785
5
5
  SHA512:
6
- metadata.gz: d6ee7f7510ca466d16ec3112ed47df4bfc02d8a17b736ab323d5ee5ac77d523ab3083dccf073bdb328be397006b67230cf7d8fcff4aaae4e9d8095ddd1665dd5
7
- data.tar.gz: 5ea56025a3f93e3cbb3db96f81cc4bc7ffafa4524cdd53beec6b412b1c6d1fc331dc7b38c9d02e7704a89bc28dd51f4b377db8e97bc81805e1814a02deac1f21
6
+ metadata.gz: babca3507daca599a095c21b0c7d517bc6dd0ad3e4f3cce22763b36784fc8be09fe84d2af9b32efdf221239a4ef4b0bdbbd9b85d7eca513368e2e6e6e99297c7
7
+ data.tar.gz: c40b99a30e36cce98d1bcc11fb3e9bf53dd0c605f79b1701499f7d21a91fe63f26ad836cff952d9ca8bba7d2c52b89fbb25afff87cade2faf404f4808f5d69a4
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?
@@ -731,6 +731,18 @@ module Jekyll
731
731
  link_to link_target_for(keys[0]), render_citation(items), {class: config['cite_class']}
732
732
  end
733
733
 
734
+ def nocite(keys)
735
+ items = keys.map do |key|
736
+ if bibliography.key?(key)
737
+ entry = bibliography[key]
738
+ cited_keys << entry.key
739
+ cited_keys.uniq!
740
+ else
741
+ return missing_reference
742
+ end
743
+ end
744
+ end
745
+
734
746
  def cite_details(key, text)
735
747
  if bibliography.key?(key)
736
748
  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.0'.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.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: 2021-03-29 00:00:00.000000000 Z
11
+ date: 2022-05-19 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