jekyll-bits 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c0216dad4c252409e12cc0f6524e2a049ef48c09
4
+ data.tar.gz: 85a2fd3912db59a08f8e130328e6474c2ca67ee0
5
+ SHA512:
6
+ metadata.gz: e43322867f3d27fc7a1d9d393b13bb8b1b35f9a74c4df0e6aadb29f56306f532ec6ecc976673bddba36466fccc4d1321930fb022045c9f552f43d9a71d7b6e40
7
+ data.tar.gz: a351e55fa949f2cdacbd28269acbbb8ec49ba03b03aa264b720d4e6951d29444f3a09e5c105346c8cfe48a9bce84fa9e5250cdfa1f108daebd0ca4888feddae4
data/.0pdd.yml ADDED
@@ -0,0 +1,3 @@
1
+ alerts:
2
+ github:
3
+ - yegor256
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ Gemfile.lock
2
+ *.gem
3
+ .bundle/
4
+ .DS_Store
5
+ rdoc/
data/.pdd ADDED
@@ -0,0 +1,5 @@
1
+ --source=.
2
+ --verbose
3
+ --rule min-words:20
4
+ --rule min-estimate:15
5
+ --rule max-estimate:90
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+
4
+ MethodLength:
5
+ Max: 30
data/.rultor.yml ADDED
@@ -0,0 +1,20 @@
1
+ assets:
2
+ rubygems.yml: zerocracy/home#assets/rubygems.yml
3
+ release:
4
+ script: |-
5
+ sudo bundle install
6
+ rake
7
+ rm -rf *.gem
8
+ sed -i "s/1\.0\.snapshot/${tag}/g" jekyll-bits.gemspec
9
+ git add jekyll-bits.gemspec
10
+ git commit -m "version set to ${tag}"
11
+ gem build jekyll-bits.gemspec
12
+ chmod 0600 ../rubygems.yml
13
+ gem push *.gem --config-file ../rubygems.yml
14
+ commanders:
15
+ - yegor256
16
+ architect:
17
+ - yegor256
18
+ merge:
19
+ commanders: []
20
+ deploy: {}
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ branches:
5
+ only:
6
+ - master
7
+ install:
8
+ - bundle install
9
+ script:
10
+ - set -e
11
+ - rake
12
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/README.md ADDED
@@ -0,0 +1,97 @@
1
+ [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/jekyll-bits)](http://www.rultor.com/p/yegor256/jekyll-bits)
2
+ [![We recommend RubyMine](http://img.teamed.io/rubymine-recommend.svg)](https://www.jetbrains.com/ruby/)
3
+
4
+ [![Build Status](https://travis-ci.org/yegor256/jekyll-bits.svg)](https://travis-ci.org/yegor256/jekyll-bits)
5
+ [![Gem Version](https://badge.fury.io/rb/jekyll-bits.svg)](http://badge.fury.io/rb/jekyll-bits)
6
+ [![Dependency Status](https://gemnasium.com/yegor256/jekyll-bits.svg)](https://gemnasium.com/yegor256/jekyll-bits)
7
+ [![Code Climate](http://img.shields.io/codeclimate/github/yegor256/jekyll-bits.svg)](https://codeclimate.com/github/yegor256/jekyll-bits)
8
+
9
+ It's a collection of very simply and useful [Jekyll](https://jekyllrb.com/) plugins,
10
+ which I'm using on [my blog](https://github.com/yegor256/blog).
11
+
12
+ To start, add it to your `_config.yml`:
13
+
14
+ ```yaml
15
+ gems:
16
+ - jekyll-bits
17
+ ```
18
+
19
+ # `jb_picture`
20
+
21
+ Add this to the [front matter](https://jekyllrb.com/docs/frontmatter/) of
22
+ your Jekyll page:
23
+
24
+ ```yaml
25
+ ---
26
+ jb_picture: http://...
27
+ ---
28
+ ```
29
+
30
+ Or with more details:
31
+
32
+ ```yaml
33
+ ---
34
+ jb_picture:
35
+ src: ... SRC attribute of <IMG>
36
+ alt: ... ALT attribute of <IMG>
37
+ href: ... HREF attribute of <A>
38
+ ---
39
+ ```
40
+
41
+ Then, in the HTML `<head>`:
42
+
43
+ ```liquid
44
+ {{ page | jb_picture_head }}
45
+ ```
46
+
47
+ This meta information will be rendered:
48
+
49
+ ```html
50
+ <meta property='og:image' content='...'/>
51
+ ```
52
+
53
+ Then, in the HTML `<body>`:
54
+
55
+ ```liquid
56
+ {{ page | jb_picture_body }}
57
+ ```
58
+
59
+ Or this way:
60
+
61
+ ```liquid
62
+ {% jb_picture_body %}
63
+ ```
64
+
65
+ Something like that will be rendered:
66
+
67
+ ```html
68
+ <figure class='jb_picture'>
69
+ <a href='...'>
70
+ <img alt='...' src='...'/>
71
+ </a>
72
+ </figure>
73
+ ```
74
+
75
+ # License
76
+
77
+ (The MIT License)
78
+
79
+ Copyright (c) 2016 Yegor Bugayenko
80
+
81
+ Permission is hereby granted, free of charge, to any person obtaining a copy
82
+ of this software and associated documentation files (the 'Software'), to deal
83
+ in the Software without restriction, including without limitation the rights
84
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
85
+ copies of the Software, and to permit persons to whom the Software is
86
+ furnished to do so, subject to the following conditions:
87
+
88
+ The above copyright notice and this permission notice shall be included in all
89
+ copies or substantial portions of the Software.
90
+
91
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
96
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
97
+ SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,62 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Copyright (c) 2016 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require 'rubygems'
24
+ require 'rake'
25
+ require 'rdoc'
26
+ require 'rake/clean'
27
+
28
+ CLEAN = FileList['coverage', 'rdoc']
29
+
30
+ def name
31
+ @name ||= File.basename(Dir['*.gemspec'].first, '.*')
32
+ end
33
+
34
+ def version
35
+ Gem::Specification.load(Dir['*.gemspec'].first).version
36
+ end
37
+
38
+ task default: [:clean, :test, :rdoc, :rubocop]
39
+
40
+ require 'rake/testtask'
41
+ desc 'Run all unit tests'
42
+ Rake::TestTask.new(:test) do |test|
43
+ test.libs << 'lib' << 'test'
44
+ test.pattern = 'test/**/test_*.rb'
45
+ test.verbose = false
46
+ end
47
+
48
+ require 'rdoc/task'
49
+ desc 'Build RDoc documentation'
50
+ Rake::RDocTask.new do |rdoc|
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "#{name} #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
56
+
57
+ require 'rubocop/rake_task'
58
+ desc 'Run RuboCop on all directories'
59
+ RuboCop::RakeTask.new(:rubocop) do |task|
60
+ task.fail_on_error = true
61
+ task.requires << 'rubocop-rspec'
62
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ require 'English'
3
+ Gem::Specification.new do |s|
4
+ s.specification_version = 2 if s.respond_to? :specification_version=
5
+ if s.respond_to? :required_rubygems_version=
6
+ s.required_rubygems_version = Gem::Requirement.new('>= 0')
7
+ end
8
+ s.rubygems_version = '2.2.2'
9
+ s.required_ruby_version = '>= 1.9.3'
10
+ s.name = 'jekyll-bits'
11
+ s.version = '0.1'
12
+ s.license = 'MIT'
13
+ s.summary = 'Jekyll Bits'
14
+ s.description = 'Useful and very simple Jekyll plugins'
15
+ s.authors = ['Yegor Bugayenko']
16
+ s.email = 'yegor256@gmail.com'
17
+ s.homepage = 'http://github.com/yegor256/jekyll-bits'
18
+ s.files = `git ls-files`.split($RS)
19
+ s.test_files = s.files.grep(%r{^(test)/})
20
+ s.rdoc_options = ['--charset=UTF-8']
21
+ s.extra_rdoc_files = ['README.md']
22
+ s.add_runtime_dependency('jekyll', '>=1.5.1')
23
+ s.add_development_dependency 'coveralls', '0.7.0'
24
+ s.add_development_dependency 'rdoc', '3.11'
25
+ s.add_development_dependency 'minitest', '5.4.0'
26
+ s.add_development_dependency 'rubocop', '0.46.0'
27
+ s.add_development_dependency 'rubocop-rspec', '1.8.0'
28
+ end
@@ -0,0 +1,64 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2016 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require 'liquid'
24
+
25
+ # Jekyll module
26
+ module Jekyll
27
+ # All our custom filters
28
+ module JbFilters
29
+ def jb_picture_head(page)
30
+ yaml = page['jb_picture']
31
+ return unless yaml
32
+ src = if yaml.is_a?(Array)
33
+ yaml['src']
34
+ else
35
+ yaml
36
+ end
37
+ "<meta property='og:image' content='#{src}'/>"
38
+ end
39
+
40
+ def jb_picture_body(page)
41
+ yaml = page['jb_picture']
42
+ return unless yaml
43
+ if yaml.is_a?(Array)
44
+ "<figure class='jb_picture'><a \
45
+ href='#{CGI.escapeElement(yaml['href'])}'>\
46
+ <img alt='#{CGI.escapeElement(yaml['alt'])}' \
47
+ src='#{CGI.escapeElement(yaml['src'])}'/></a></figure>"
48
+ else
49
+ "<figure class='jb_picture'><img \
50
+ alt='front picture' src='#{CGI.escapeElement(yaml)}'/></figure>"
51
+ end
52
+ end
53
+ end
54
+
55
+ # Jekyll block
56
+ class JbPictureBlock < Liquid::Tag
57
+ def render(context)
58
+ JbFilters.jb_picture_body(context.registers[:page])
59
+ end
60
+ end
61
+ end
62
+
63
+ Liquid::Template.register_filter(Jekyll::JbFilters)
64
+ Liquid::Template.register_tag('jb_picture_body', Jekyll::JbPictureBlock)
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-bits
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Yegor Bugayenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-24 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: 1.5.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.7.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: '3.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: '3.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 5.4.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 5.4.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.46.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.46.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 1.8.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.8.0
97
+ description: Useful and very simple Jekyll plugins
98
+ email: yegor256@gmail.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files:
102
+ - README.md
103
+ files:
104
+ - ".0pdd.yml"
105
+ - ".gitignore"
106
+ - ".pdd"
107
+ - ".rubocop.yml"
108
+ - ".rultor.yml"
109
+ - ".travis.yml"
110
+ - Gemfile
111
+ - README.md
112
+ - Rakefile
113
+ - jekyll-bits.gemspec
114
+ - lib/jekyll_bits.rb
115
+ homepage: http://github.com/yegor256/jekyll-bits
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options:
121
+ - "--charset=UTF-8"
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 1.9.3
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.4.5.1
137
+ signing_key:
138
+ specification_version: 2
139
+ summary: Jekyll Bits
140
+ test_files: []