bibsonomy-jekyll 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +19 -0
- data/lib/bibsonomy-jekyll.rb +17 -8
- data/lib/version.rb +1 -1
- data/spec/bibsonomy-jekyll_spec.rb +13 -0
- data/spec/fixtures/page_variable_expansion.md +11 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 608486d03c7cb67d040cc766e4a2b060f5c9fbb3
|
4
|
+
data.tar.gz: b954916553fbe34dbd1db02c34361c3584afb151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6bdce6f5ecbed2cc500799b050520db40da8b8b3add46c5c672c5be653f48bc4197e0fc3afcb3070883b07bcb036a09c1f1746406c3e1eec0235d0f0e1f48f1
|
7
|
+
data.tar.gz: 5394fa1e4183ea27cb8236dfb8e768ab8b240df6ffe1345e6b043890004c943fa11309a1636922456863f37a8003d9efc2ef223f87a5928ead7d734667b7719f
|
data/README.markdown
CHANGED
@@ -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
|
+
```
|
data/lib/bibsonomy-jekyll.rb
CHANGED
@@ -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
|
-
|
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(
|
61
|
+
html = csl.render(grouping, name, tags, count)
|
53
62
|
|
54
63
|
# set date to now
|
55
64
|
context.registers[:page]["date"] = Time.new
|
data/lib/version.rb
CHANGED
@@ -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
|
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.
|
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-
|
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:
|