bibsonomy-jekyll 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: '068e6eece2143f61e32dfcd93afe8a65bba5df2a'
4
- data.tar.gz: 3743b16a9b0155471aa18c59d5c6714a9626ea90
3
+ metadata.gz: 608486d03c7cb67d040cc766e4a2b060f5c9fbb3
4
+ data.tar.gz: b954916553fbe34dbd1db02c34361c3584afb151
5
5
  SHA512:
6
- metadata.gz: 6d47174890820ceff0300cb9761424d4701277431f5e1ef01b07b9569dd8805d255edc8c16594dfdead1fe30f1055c77d4d089539bc1c60a6b4e45535922969b
7
- data.tar.gz: 747800a99dac1083342b0b6f0bad2fe346cb54bc44643b8c1b5ae9778dffb9ba7024e242da824d8bf478682a110528a27cda119078d82529168656ff7eb74544
6
+ metadata.gz: b6bdce6f5ecbed2cc500799b050520db40da8b8b3add46c5c672c5be653f48bc4197e0fc3afcb3070883b07bcb036a09c1f1746406c3e1eec0235d0f0e1f48f1
7
+ data.tar.gz: 5394fa1e4183ea27cb8236dfb8e768ab8b240df6ffe1345e6b043890004c943fa11309a1636922456863f37a8003d9efc2ef223f87a5928ead7d734667b7719f
@@ -60,3 +60,22 @@ The plugin supports a variable number of parameters:
60
60
 
61
61
  For an example output, have a look at
62
62
  [my publication list](https://amor.cms.hu-berlin.de/~jaeschkr/publications.html).
63
+
64
+ ## Development
65
+
66
+ Install dependencies:
67
+ ```shell
68
+ bundle install
69
+ ```
70
+
71
+ Run tests:
72
+ ```shell
73
+ export BIBSONOMY_USER_NAME=yourusername
74
+ export BIBSONOMY_API_KEY=yourapikey
75
+ bundle exec rspec spec
76
+ ```
77
+
78
+ Build Gem:
79
+ ```shell
80
+ gem build bibsonomy-jekyll.gemspec
81
+ ```
@@ -15,6 +15,8 @@ require 'bibsonomy/csl'
15
15
  # COUNT is an integer, the number of posts to return
16
16
  #
17
17
  # Changes:
18
+ # 2018-10-08 (rja)
19
+ # - added liquid expansion
18
20
  # 2017-05-31 (rja)
19
21
  # - added support for groups and multiple tags
20
22
  #
@@ -24,16 +26,23 @@ module Jekyll
24
26
  class BibSonomyPostList < Liquid::Tag
25
27
  def initialize(tag_name, text, tokens)
26
28
  super
27
- parts = text.split(/\s+/)
28
- @grouping = parts.shift
29
- @name = parts.shift
30
- # the last element is the number of posts
31
- @count = Integer(parts.pop)
32
- # everything else are the tags
33
- @tags = parts
29
+ @input = text
34
30
  end
35
31
 
36
32
  def render(context)
33
+ # expand liquid variables
34
+ rendered_input = Liquid::Template.parse(@input).render(context)
35
+
36
+ # parse parameters
37
+ parts = rendered_input.split(/\s+/)
38
+ grouping = parts.shift
39
+ name = parts.shift
40
+ # the last element is the number of posts
41
+ count = Integer(parts.pop)
42
+ # everything else are the tags
43
+ tags = parts
44
+
45
+ # extract config
37
46
  site = context.registers[:site]
38
47
 
39
48
  # user name and API key for BibSonomy
@@ -49,7 +58,7 @@ module Jekyll
49
58
  # CSL style for rendering
50
59
  csl.style = bib_config['style']
51
60
 
52
- html = csl.render(@grouping, @name, @tags, @count)
61
+ html = csl.render(grouping, name, tags, count)
53
62
 
54
63
  # set date to now
55
64
  context.registers[:page]["date"] = Time.new
@@ -1,3 +1,3 @@
1
1
  module BibSonomyJekyll
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -15,4 +15,17 @@ RSpec.describe "BibSonomy" do
15
15
  expect(content).to match(%r!<a href="https://www.bibsonomy.org/publication/893978f4a3ac2c5556e391b8749ed8c0/bibsonomy-ruby">BibSonomy</a>!)
16
16
  end
17
17
  end
18
+
19
+ context "variable expansion" do
20
+ let(:content) { File.read(dest_dir("page_variable_expansion.html")) }
21
+
22
+ it "renders list item" do
23
+ expect(content).to match(%r!<li class="paper-conference">!)
24
+ end
25
+
26
+ it "renders link" do
27
+ expect(content).to match(%r!<a href="https://www.bibsonomy.org/publication/893978f4a3ac2c5556e391b8749ed8c0/bibsonomy-ruby">BibSonomy</a>!)
28
+ end
29
+ end
30
+
18
31
  end
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Test Page
3
+ layout: default
4
+ buser: bibsonomy-ruby
5
+ ---
6
+
7
+ ** Jekyll BibSonomy Plugin **
8
+
9
+
10
+
11
+ {% bibsonomy user {{page.buser}} test 1 %}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibsonomy-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Jäschke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-14 00:00:00.000000000 Z
11
+ date: 2018-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -109,6 +109,7 @@ files:
109
109
  - lib/version.rb
110
110
  - spec/bibsonomy-jekyll_spec.rb
111
111
  - spec/fixtures/page.md
112
+ - spec/fixtures/page_variable_expansion.md
112
113
  - spec/spec_helper.rb
113
114
  homepage: https://github.com/rjoberon/bibsonomy-jekyll
114
115
  licenses: