bibsonomy-jekyll 0.1.10 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b21aa1061ef200ae0c45200118c1a0b763d45a1dd7a410d2c61651b945b1f4e
4
- data.tar.gz: 3134c65479dc33fc052802bf4a02838f6e206459ef3b2c729aa44974c0171244
3
+ metadata.gz: 10ae0fc57a24aa8da1b5b07e5b27298f0da3381837d671293d870deff4b0ac8e
4
+ data.tar.gz: 55835aa89cff1993d17f7ee4401e83251a57b868f7d7565f94c9ee9a70741132
5
5
  SHA512:
6
- metadata.gz: 3a8c25ccd55859ad9510ae74d85b58c8bab6779b754d5dd2d922a0e6c1c17108338f8a7828c355adb40ede179a3851eb5adde3d0c79b28a58b6b0c87098b3af0
7
- data.tar.gz: ff0a5a26061a2d00598ed75506cf94a9195e02741eddd4f3c1e94ac1d256e5be903ee969539cfe8fb34d6086cdefeff3a085ea59183e715d6053d972ebaf49ea
6
+ metadata.gz: fc8f43275bd89a4d24532c5d5a6c5642d455a692e1db28d6fe4a4fb0f33ad43aca42cf13b5b7bc244ad9bea859ffdbc6519141f51f7a87d08d0a5ce343da3eaf
7
+ data.tar.gz: df27875333fc73667618a5ede6d04a6c4614615685d9a84aee950be299a7e1a6bd15c67e18fad264e2950dcbf7ccda5bd336fc7fe9f8f4010c0b8ea20298f99b
data/README.markdown CHANGED
@@ -32,6 +32,7 @@ bibsonomy:
32
32
  document_directory: pdf
33
33
  # check https://github.com/citation-style-language/styles for styles
34
34
  style: acm-sig-proceedings
35
+ year_headings: true
35
36
  # see http://api.altmetric.com/embeds.html for types and JavaScript
36
37
  # to enable them; empty value disables rendering
37
38
  altmetric_badge_type: 1
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.summary = 'BibSonomy plugin for Jekyll'
10
10
  s.version = BibSonomyJekyll::VERSION
11
11
  s.authors = ['Robert Jäschke']
12
- s.email = 'jaeschke@l3s.de'
12
+ s.email = 'robert.jaeschke@hu-berlin.de'
13
13
  s.description = %q{Enables rendering of posts from BibSonomy with a Jekyll tag.}
14
14
 
15
15
  s.homepage = 'https://github.com/rjoberon/bibsonomy-jekyll'
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.required_ruby_version = '>= 3.0'
20
20
 
21
- s.add_dependency 'jekyll', '~> 3.8', '>= 3.8.3'
22
- s.add_dependency 'bibsonomy', '~> 0.4', '>= 0.4.18'
21
+ s.add_dependency 'jekyll', '>= 3.8.3', "< 5.0"
22
+ s.add_dependency 'bibsonomy', '~> 0.4', '>= 0.4.19'
23
23
 
24
- s.add_development_dependency 'rake', '~> 12.3'
24
+ s.add_development_dependency 'rake', '~> 13'
25
25
  s.add_development_dependency "rspec", "~> 3.5"
26
26
  s.add_development_dependency "rubocop", "~> 0.57"
27
27
  s.add_development_dependency "coveralls", '~> 0.7'
@@ -33,8 +33,14 @@ module Jekyll
33
33
  # expand liquid variables
34
34
  rendered_input = Liquid::Template.parse(@input).render(context)
35
35
 
36
+ bib_config = context.registers[:site].config['bibsonomy']
37
+ #bib_config = site.config['bibsonomy']
38
+
36
39
  # parse parameters
37
40
  parts = rendered_input.split(/\s+/)
41
+ # parameters starting with : can override configuration options
42
+ override_config(bib_config, parts)
43
+
38
44
  grouping = parts.shift
39
45
  name = parts.shift
40
46
  # the last element is the number of posts
@@ -46,7 +52,6 @@ module Jekyll
46
52
  site = context.registers[:site]
47
53
 
48
54
  # user name and API key for BibSonomy
49
- bib_config = site.config['bibsonomy']
50
55
  csl = BibSonomy::CSL.new(bib_config['user'], bib_config['apikey'])
51
56
 
52
57
  # target directory for PDF documents
@@ -57,6 +62,7 @@ module Jekyll
57
62
 
58
63
  # CSL style for rendering
59
64
  csl.style = bib_config['style']
65
+ csl.year_headings = bib_config['year_headings'].downcase == "true"
60
66
 
61
67
  html = csl.render(grouping, name, tags, count)
62
68
 
@@ -65,6 +71,14 @@ module Jekyll
65
71
 
66
72
  return html
67
73
  end
74
+
75
+ def override_config(config, parts)
76
+ # parameters starting with : can override configuration options
77
+ # only at the beginning → the first string without : stops loop
78
+ while parts[0].start_with?(':')
79
+ config[parts.shift[1..]] = parts.shift
80
+ end
81
+ end
68
82
  end
69
83
 
70
84
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module BibSonomyJekyll
2
- VERSION = "0.1.10"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -28,4 +28,16 @@ RSpec.describe "BibSonomy" do
28
28
  end
29
29
  end
30
30
 
31
+ context "full page rendering with apa style" do
32
+ let(:content) { File.read(dest_dir("page_other_style.html")) }
33
+
34
+ it "renders list item" do
35
+ expect(content).to match(%r!<li class="paper-conference">!)
36
+ end
37
+
38
+ it "renders link" do
39
+ expect(content).to match(%r!<a href="https://www.bibsonomy.org/publication/893978f4a3ac2c5556e391b8749ed8c0/bibsonomy-ruby">BibSonomy</a>!)
40
+ end
41
+ end
42
+
31
43
  end
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Test Page With Another Style Option
3
+ layout: default
4
+ ---
5
+
6
+ ** Jekyll BibSonomy Plugin **
7
+
8
+ {% bibsonomy :style apa :year_headings false user bibsonomy-ruby test 1 %}
data/spec/spec_helper.rb CHANGED
@@ -40,12 +40,12 @@ RSpec.configure do |config|
40
40
  site_config = Jekyll.configuration(CONFIG_DEFAULTS.merge(options))
41
41
  # get api key and user name from environment (configured via
42
42
  # .travis.yml on Travis or manually when testing locally)
43
- site_config["bibsonomy"] = {"user" => ENV['BIBSONOMY_USER_NAME'], "apikey" => ENV['BIBSONOMY_API_KEY']}
43
+ site_config["bibsonomy"] = {"user" => ENV['BIBSONOMY_USER_NAME'], "apikey" => ENV['BIBSONOMY_API_KEY'], "style" => "springer-lecture-notes-in-computer-science", "year_headings" => "true"}
44
44
  Jekyll::Site.new(site_config)
45
45
  end
46
46
 
47
47
  def make_context(registers = {}, environments = {})
48
- Liquid::Context.new(environments, {},
48
+ Liquid::Context.new(environments, {},
49
49
  { :site => site, :page => page }.merge(registers))
50
50
  end
51
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibsonomy-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Jäschke
@@ -13,22 +13,22 @@ dependencies:
13
13
  name: jekyll
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
17
- - !ruby/object:Gem::Version
18
- version: '3.8'
19
16
  - - ">="
20
17
  - !ruby/object:Gem::Version
21
18
  version: 3.8.3
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '3.8'
29
26
  - - ">="
30
27
  - !ruby/object:Gem::Version
31
28
  version: 3.8.3
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5.0'
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: bibsonomy
34
34
  requirement: !ruby/object:Gem::Requirement
@@ -38,7 +38,7 @@ dependencies:
38
38
  version: '0.4'
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 0.4.18
41
+ version: 0.4.19
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -48,21 +48,21 @@ dependencies:
48
48
  version: '0.4'
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: 0.4.18
51
+ version: 0.4.19
52
52
  - !ruby/object:Gem::Dependency
53
53
  name: rake
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: '12.3'
58
+ version: '13'
59
59
  type: :development
60
60
  prerelease: false
61
61
  version_requirements: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - "~>"
64
64
  - !ruby/object:Gem::Version
65
- version: '12.3'
65
+ version: '13'
66
66
  - !ruby/object:Gem::Dependency
67
67
  name: rspec
68
68
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0.7'
108
108
  description: Enables rendering of posts from BibSonomy with a Jekyll tag.
109
- email: jaeschke@l3s.de
109
+ email: robert.jaeschke@hu-berlin.de
110
110
  executables: []
111
111
  extensions: []
112
112
  extra_rdoc_files: []
@@ -122,6 +122,7 @@ files:
122
122
  - lib/version.rb
123
123
  - spec/bibsonomy-jekyll_spec.rb
124
124
  - spec/fixtures/page.md
125
+ - spec/fixtures/page_other_style.md
125
126
  - spec/fixtures/page_variable_expansion.md
126
127
  - spec/spec_helper.rb
127
128
  homepage: https://github.com/rjoberon/bibsonomy-jekyll