jekyll-scholar 6.8.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: 9003e905d46343a563b51568a93777e2fda49ede94e0cf34f0efc326eff8d6f8
4
- data.tar.gz: cc3020a8bd67e1ae7e1a7d069b47c3ffa359dd22f003ab05e7ea15d3fcc66b34
3
+ metadata.gz: 287c638fa9bd7e062280db1af05a5d98cc9d509c423ce1b8d0f7d948f3498b16
4
+ data.tar.gz: 606db44855a017a7694b61560ef7779c95118f461301298e7875bc1fbf5d2785
5
5
  SHA512:
6
- metadata.gz: 4d297673512e24ba530830d62ae7c3ff89a3a6360593f6bb0cda41ad93e4a64276576ed4d05d47283b66d6825ef9a399f970b01bc616eb5f3bf1aa83794a9978
7
- data.tar.gz: 57901b71b3ac3c289b19d8c60167593a08928f6a2d8c9608456806e0bab8d5e22e181e2ba547fe9f9db8cbb5e76c0132e9c71205115454355829a7efe6787a9d
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
  -----
@@ -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`. |
@@ -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"
@@ -40,3 +40,33 @@ Feature: Page Configuration
40
40
  And I should see "The Ruby Programming Language" in "_site/scholar.html"
41
41
  And I should not see "Programming Ruby" in "_site/scholar.html"
42
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
+
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_runtime_dependency('jekyll', '~> 4.0')
28
28
  s.add_runtime_dependency('citeproc-ruby', '~> 1.0')
29
29
  s.add_runtime_dependency('csl-styles', '~> 1.0')
30
- s.add_runtime_dependency('bibtex-ruby', '~> 5.0')
30
+ s.add_runtime_dependency('bibtex-ruby', '~> 6.0')
31
31
 
32
32
  s.files = `git ls-files`.split("\n")
33
33
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -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?
@@ -527,10 +527,11 @@ module Jekyll
527
527
  .merge(site.site_payload)
528
528
  .merge({
529
529
  'index' => index,
530
+ 'page' => context.registers[:page],
530
531
  'details' => details_link_for(entry)
531
532
  }),
532
533
  {
533
- :registers => { :site => site },
534
+ :registers => context.registers,
534
535
  :filters => [Jekyll::Filters]
535
536
  })
536
537
  end
@@ -730,6 +731,18 @@ module Jekyll
730
731
  link_to link_target_for(keys[0]), render_citation(items), {class: config['cite_class']}
731
732
  end
732
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
+
733
746
  def cite_details(key, text)
734
747
  if bibliography.key?(key)
735
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 = '6.8.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: 6.8.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: 2020-06-08 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
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.0'
61
+ version: '6.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.0'
68
+ version: '6.0'
69
69
  description: " Jekyll-Scholar is for all the academic bloggers out there. It is a
70
70
  set of extensions for Jekyll the awesome, blog aware, static site generator; it
71
71
  formats your BibTeX bibliographies for the web using CSL citation styles and generally
@@ -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.1.2
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