bibsonomy-jekyll 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/bibsonomy-jekyll.rb +62 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7995c76d44fd6991fb21b517a05d566a0d6b6409
|
4
|
+
data.tar.gz: 7dc7d6dd3744a94d53faac255f59d776364b2dd3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3aff8044b849f5de6a239268132528a08744a04144b8b63a6c21ac159a1d09a46b57c56c35fd7462b83846943176e2a3468538cc00fb0621dc30cafc97ef0b1f
|
7
|
+
data.tar.gz: 8326c26f9648015ffde7c540106b529a424e67c2e714b46387c4bef57337bf55560f005e47c98c3d4f1014b89229a74d9d1930928ba0a62b75f22096bed86c35
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'jekyll'
|
3
|
+
require 'time'
|
4
|
+
require 'bibsonomy/csl'
|
5
|
+
|
6
|
+
|
7
|
+
#
|
8
|
+
# Jekyll Tag to render posts from BibSonomy.
|
9
|
+
#
|
10
|
+
# Usage: {% bibsonomy GROUPING NAME TAG1 TAG2 ... TAGN COUNT %}
|
11
|
+
# where
|
12
|
+
# GROUPING is either "user" or "group" and specifies the type of NAME
|
13
|
+
# NAME is the name of the group or user
|
14
|
+
# TAG1 ... TAGN are tags
|
15
|
+
# COUNT is an integer, the number of posts to return
|
16
|
+
#
|
17
|
+
# Changes:
|
18
|
+
# 2017-05-31 (rja)
|
19
|
+
# - added support for groups and multiple tags
|
20
|
+
#
|
21
|
+
|
22
|
+
module Jekyll
|
23
|
+
|
24
|
+
class BibSonomyPostList < Liquid::Tag
|
25
|
+
def initialize(tag_name, text, tokens)
|
26
|
+
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
|
34
|
+
end
|
35
|
+
|
36
|
+
def render(context)
|
37
|
+
site = context.registers[:site]
|
38
|
+
|
39
|
+
# user name and API key for BibSonomy
|
40
|
+
bib_config = site.config['bibsonomy']
|
41
|
+
user_name = bib_config['user']
|
42
|
+
api_key = bib_config['apikey']
|
43
|
+
csl = BibSonomy::CSL.new(user_name, api_key)
|
44
|
+
|
45
|
+
# target directory for PDF documents
|
46
|
+
csl.pdf_dir = bib_config['document_directory']
|
47
|
+
|
48
|
+
# CSL style for rendering
|
49
|
+
csl.style = bib_config['style']
|
50
|
+
|
51
|
+
html = csl.render(@grouping, @name, @tags, @count)
|
52
|
+
|
53
|
+
# set date to now
|
54
|
+
context.registers[:page]["date"] = Time.new
|
55
|
+
|
56
|
+
return html
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
Liquid::Template.register_tag('bibsonomy', Jekyll::BibSonomyPostList)
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bibsonomy-jekyll
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert Jäschke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bibsonomy
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.4'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.4.8
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0.4'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.4.8
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rdoc
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.0'
|
89
|
+
description: Enables rendering of posts from BibSonomy with a Jekyll tag.
|
90
|
+
email: jaeschke@l3s.de
|
91
|
+
executables: []
|
92
|
+
extensions: []
|
93
|
+
extra_rdoc_files: []
|
94
|
+
files:
|
95
|
+
- lib/bibsonomy-jekyll.rb
|
96
|
+
homepage: https://github.com/rjoberon/bibsonomy-jekyll
|
97
|
+
licenses:
|
98
|
+
- GPL 3
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.2.2
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: BibSonomy plugin for Jekyll
|
120
|
+
test_files: []
|