jekyll-poole 0.0.2 → 0.1.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 +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +21 -0
- data/.travis.yml +6 -0
- data/Gemfile +15 -0
- data/Guardfile +7 -0
- data/LICENSE +21 -0
- data/README.md +136 -0
- data/Rakefile +9 -0
- data/jekyll-poole.gemspec +11 -11
- data/lib/jekyll-poole.rb +1 -1
- data/lib/poole/renderer.rb +36 -18
- data/lib/poole/tags.rb +6 -5
- data/lib/poole/version.rb +6 -2
- data/spec/fixtures/.gitignore +1 -0
- data/spec/fixtures/_config.yml +7 -0
- data/spec/fixtures/_layouts/default.md +9 -0
- data/spec/fixtures/_layouts/post.md +3 -0
- data/spec/fixtures/_posts/2014-11-21-default-tags.md +8 -0
- data/spec/fixtures/_posts/2014-11-22-what-can-poole-do-for-you.md +12 -0
- data/spec/fixtures/about.md +6 -0
- data/spec/fixtures/index.html +5 -0
- data/spec/lib/tags_spec.rb +293 -0
- data/spec/spec_helper.rb +75 -0
- data/spec/support/fixture_helpers.rb +8 -0
- metadata +35 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43fe72b228424e64a4f61f1385001a4d0595ef65
|
4
|
+
data.tar.gz: f771d66ce3ab9a0c7d1f9c2fa024ce96e33a7c21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13ec369853196fdc28a2a7a87e70857b5357586f117ab53fd25719ff3864d726dbb534fedc0d4a8b3cd639ae87f62a1eed307f7b0392f9f183d668704fa7da1e
|
7
|
+
data.tar.gz: 8f9da9e5f68e90487dcfe679d0d58b424731376099cfee74da657fdcaee44c5923a97edfadeefd80dd03047315a4a2fb2e18ee61cbb240bd03c27b9d5b666fd9
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require ./lib/jekyll-poole --color --format documentation
|
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-11-23 17:13:33 -0600 using RuboCop version 0.26.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 1
|
9
|
+
# Cop supports --auto-correct.
|
10
|
+
Lint/UnusedBlockArgument:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
# Configuration parameters: CountComments.
|
15
|
+
Metrics/MethodLength:
|
16
|
+
Max: 12
|
17
|
+
|
18
|
+
# Offense count: 1
|
19
|
+
# Configuration parameters: Exclude.
|
20
|
+
Style/FileName:
|
21
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Ian Carrico
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
Mr. Poole's Jekyll Tools
|
2
|
+
------------------------
|
3
|
+
|
4
|
+
[![Gem version][gem-image]][gem-url] [![Build Status][travis-image]][travis-url] [![License MIT][license-image]][license-url] [![Downloads][downloads-image]][gem-url] [![Coverage Status][coverage-image]][coverage-url]
|
5
|
+
|
6
|
+
```
|
7
|
+
.___ ___. .______ _-----_
|
8
|
+
| \/ | | _ \ | - - |
|
9
|
+
| \ / | | |_) | | ω |
|
10
|
+
| |\/| | | / | ___ |
|
11
|
+
| | | | | |\ \ __ __'.___.'__
|
12
|
+
|__| |__| | _| `._\ (__) ´ >-< `
|
13
|
+
|
14
|
+
.______ ______ ______ __ _______
|
15
|
+
| _ \ / __ \ / __ \ | | | ____|
|
16
|
+
| |_) | | | | | | | | | | | | |__
|
17
|
+
| ___/ | | | | | | | | | | | __|
|
18
|
+
| | | `--' | | `--' | | `----.| |____
|
19
|
+
| _| \______/ \______/ |_______||_______|
|
20
|
+
```
|
21
|
+
|
22
|
+
For the Yeoman generator that set's up a Jekyll site for you, check out [Mr. Poole, the Jekyll Site Generator](https://github.com/iamcarrico/generator-poole/).
|
23
|
+
|
24
|
+
This set of tools are some extensions to Jekyll to help make your site a little better.
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
Add this line to your application's Gemfile:
|
29
|
+
|
30
|
+
```
|
31
|
+
gem 'jekyll-poole'
|
32
|
+
```
|
33
|
+
|
34
|
+
And then execute:
|
35
|
+
|
36
|
+
```
|
37
|
+
$ bundle
|
38
|
+
```
|
39
|
+
|
40
|
+
Or install it yourself as:
|
41
|
+
|
42
|
+
```
|
43
|
+
$ gem install jekyll-poole
|
44
|
+
```
|
45
|
+
|
46
|
+
## Use
|
47
|
+
|
48
|
+
You must first ensure Jekyll is pulling in this extension. Common practices are to copy the following code into ```_plugins/ext.rb```:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require 'jekyll-poole'
|
52
|
+
```
|
53
|
+
|
54
|
+
### Adding in Open Graph tags
|
55
|
+
|
56
|
+
The primary use of the Mr. Poole's Jekyll extension is to add in the proper meta tags for Open Graph, and other meta-information. You can add in all tags available by adding the following code within your <head> tag.
|
57
|
+
|
58
|
+
```liquid
|
59
|
+
{% poole_tags %}
|
60
|
+
```
|
61
|
+
|
62
|
+
Optionally, you may choose any of the following tags to insert them in one-by-one.
|
63
|
+
|
64
|
+
```liquid
|
65
|
+
{% poole_tags site_name %}
|
66
|
+
```
|
67
|
+
Adds in the og:site_name tag. This will pull from the ```tite``` in ```_config.yml```.
|
68
|
+
|
69
|
+
```liquid
|
70
|
+
{% poole_tags title %}
|
71
|
+
```
|
72
|
+
|
73
|
+
Puts in the og:title tag. This will be either the page title, or the site_name if a page title is not present.
|
74
|
+
|
75
|
+
|
76
|
+
```liquid
|
77
|
+
{% poole_tags type %}
|
78
|
+
```
|
79
|
+
|
80
|
+
The og:type tag. This will be 'article' unless a page title is not set, in which it will be 'website'.
|
81
|
+
|
82
|
+
|
83
|
+
```liquid
|
84
|
+
{% poole_tags description %}
|
85
|
+
```
|
86
|
+
|
87
|
+
The og:description tag. This will be pulled from an option "description" from the post's frontmatter. Working on having this pull from the post's excerpt if this does not exist.
|
88
|
+
|
89
|
+
|
90
|
+
```liquid
|
91
|
+
{% poole_tags published_time %}
|
92
|
+
```
|
93
|
+
|
94
|
+
The article:published_time tag, which pulls from page's date. Will be properly formatted in the iso8601 format.
|
95
|
+
|
96
|
+
```liquid
|
97
|
+
{% poole_tags author %}
|
98
|
+
```
|
99
|
+
|
100
|
+
The article:author tag, which will pull from the page's 'author' frontmatter if it is set. If not, it will be set to the site's author set in ```_config.yml```.
|
101
|
+
|
102
|
+
```liquid
|
103
|
+
{% poole_tags url %}
|
104
|
+
{% poole_tags canonical %}
|
105
|
+
```
|
106
|
+
|
107
|
+
The url tag will add in the og:url tag, and the canonical will add in the canonical <link> tag. Both will pull from the page's permalink.
|
108
|
+
|
109
|
+
```liquid
|
110
|
+
{% poole_tags image %}
|
111
|
+
```
|
112
|
+
|
113
|
+
This will add in a og:image tag. If there is an 'image' setting on the post or page, then it will use that. If not, it will pull from the og_image from the ```_config.yml```. If neither are set, then it will be ignored.
|
114
|
+
|
115
|
+
|
116
|
+
## Thanks, Praise, Etc.
|
117
|
+
|
118
|
+
Big thanks to [@ixti](https://github.com/ixti), whose code for [jekyll-assets](https://github.com/ixti/jekyll-assets) was great inspiration for this extension. Also to [@parkr](https://github.com/parkr) who helped me with the tests, and wrote Jekyll.
|
119
|
+
|
120
|
+
## License
|
121
|
+
|
122
|
+
MIT
|
123
|
+
|
124
|
+
|
125
|
+
[travis-url]: https://travis-ci.org/iamcarrico/jekyll-poole
|
126
|
+
[travis-image]: http://img.shields.io/travis/iamcarrico/jekyll-poole.svg
|
127
|
+
|
128
|
+
[downloads-image]: http://img.shields.io/gem/dt/jekyll-poole.svg
|
129
|
+
[gem-url]: https://rubygems.org/gems/jekyll-poole
|
130
|
+
[gem-image]: http://img.shields.io/gem/v/jekyll-poole.svg
|
131
|
+
|
132
|
+
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg
|
133
|
+
[license-url]: https://github.com/iamcarrico/jekyll-poole/blob/master/LICENSE
|
134
|
+
|
135
|
+
[coverage-image]: https://img.shields.io/coveralls/iamcarrico/jekyll-poole.svg
|
136
|
+
[coverage-url]: https://coveralls.io/r/iamcarrico/jekyll-poole
|
data/Rakefile
ADDED
data/jekyll-poole.gemspec
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require 'poole/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'jekyll-poole'
|
8
8
|
spec.version = Jekyll::PoolePlugin::VERSION
|
9
|
-
spec.homepage =
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = %w
|
12
|
-
spec.license =
|
13
|
-
spec.summary =
|
9
|
+
spec.homepage = 'http://www.github.com/iamcarrico/jekyll-poole-tags'
|
10
|
+
spec.authors = ['Ian Carrico']
|
11
|
+
spec.email = %w(github@iancarrico.com)
|
12
|
+
spec.license = 'MIT'
|
13
|
+
spec.summary = 'jekyll-poole-tags-#{Jekyll::PoolePlugin::VERSION}'
|
14
14
|
spec.description = <<-DESC
|
15
15
|
A Jekyll plugin that allows the use of tags from Mr. Poole.
|
16
16
|
DESC
|
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.files = `git ls-files`.split($RS)
|
19
19
|
spec.executables = spec.files.grep(/^bin\//).map { |f| File.basename(f) }
|
20
20
|
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
21
|
-
spec.require_paths = [
|
21
|
+
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency
|
23
|
+
spec.add_dependency 'jekyll', '>= 1.0.0', '< 3.0.0'
|
24
24
|
|
25
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
26
26
|
end
|
data/lib/jekyll-poole.rb
CHANGED
data/lib/poole/renderer.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
-
|
1
|
+
# Renderer class for Mr. Poole's plugin
|
2
|
+
# Author: Ian Carrico https://iamcarrico.com
|
3
|
+
# Description: Output a list of metatags for your site.
|
4
|
+
#
|
2
5
|
|
3
6
|
module Jekyll
|
7
|
+
# The Poole Plugin module.
|
4
8
|
module PoolePlugin
|
9
|
+
# The Renderer class for Poole.
|
5
10
|
class Renderer
|
6
11
|
META_TAG = '<meta property="%{property}" content="%{content}">'
|
7
12
|
LINK_TAG = '<link rel="%{rel}" href="%{href}" />'
|
8
13
|
|
9
|
-
def initialize(context,
|
14
|
+
def initialize(context, _markup)
|
10
15
|
@site = context.registers[:site]
|
11
16
|
@page = context.registers[:page]
|
12
17
|
|
@@ -14,7 +19,7 @@ module Jekyll
|
|
14
19
|
end
|
15
20
|
|
16
21
|
def render_all
|
17
|
-
tags =
|
22
|
+
tags = []
|
18
23
|
tags << render_site_name
|
19
24
|
tags << render_title
|
20
25
|
tags << render_type
|
@@ -26,63 +31,76 @@ module Jekyll
|
|
26
31
|
tags << render_image
|
27
32
|
tags.push(*render_categoies)
|
28
33
|
|
29
|
-
tags.delete_if {|v| v
|
34
|
+
tags.delete_if { |v| v.nil? || v == '' }.join("\n")
|
30
35
|
end
|
31
36
|
|
32
37
|
def render_site_name
|
33
|
-
format
|
38
|
+
format(
|
39
|
+
META_TAG,
|
40
|
+
property: 'og:site_name',
|
41
|
+
content: @site_name) if @site_name
|
34
42
|
end
|
35
43
|
|
36
44
|
def render_title
|
37
45
|
title = @page['title'] || @site_name
|
38
|
-
format META_TAG, :
|
46
|
+
format META_TAG, property: 'og:title', content: title if title
|
39
47
|
end
|
40
48
|
|
41
49
|
def render_type
|
42
|
-
type = @page['title'] ?
|
43
|
-
format META_TAG, :
|
50
|
+
type = @page['title'] ? 'article' : 'website'
|
51
|
+
format META_TAG, property: 'og:type', content: type
|
44
52
|
end
|
45
53
|
|
54
|
+
# TODO: Pull from a post's excerpt if a description does not exist.
|
46
55
|
def render_description
|
47
56
|
description = @page['description'] || nil
|
48
57
|
|
49
|
-
format
|
58
|
+
format(
|
59
|
+
META_TAG,
|
60
|
+
property: 'og:description',
|
61
|
+
content: description) if description
|
50
62
|
end
|
51
63
|
|
52
64
|
def render_published_time
|
53
|
-
format
|
65
|
+
format(
|
66
|
+
META_TAG,
|
67
|
+
property: 'article:published_time',
|
68
|
+
content: @page['date'].iso8601) if @page['date']
|
54
69
|
end
|
55
70
|
|
56
71
|
def render_author
|
57
72
|
author = @page['author'] || @site.config['author']
|
58
|
-
format META_TAG, :
|
73
|
+
format META_TAG, property: 'article:author', content: author if author
|
59
74
|
end
|
60
75
|
|
61
76
|
def render_url
|
62
77
|
url = remove_index(@site.config['url'] + @page['url'])
|
63
|
-
format META_TAG, :
|
78
|
+
format META_TAG, property: 'og:url', content: url
|
64
79
|
end
|
65
80
|
|
66
81
|
def render_canonical
|
67
|
-
|
82
|
+
url = remove_index(@site.config['url'] + @page['url'])
|
83
|
+
format LINK_TAG, rel: 'canonical', href: url
|
68
84
|
end
|
69
85
|
|
70
86
|
def render_image
|
71
|
-
|
72
|
-
|
73
|
-
|
87
|
+
image = @page['image'] || @site.config['og_image']
|
88
|
+
format(
|
89
|
+
META_TAG,
|
90
|
+
property: 'og:image',
|
91
|
+
content: @site.config['url'] + '/' + image) if image
|
74
92
|
end
|
75
93
|
|
76
94
|
def render_categoies
|
77
95
|
Array(@page['categories']).map do |category|
|
78
|
-
format META_TAG, :
|
96
|
+
format META_TAG, property: 'article:tag', content: category
|
79
97
|
end
|
80
98
|
end
|
81
99
|
|
82
100
|
private
|
83
101
|
|
84
102
|
def remove_index(string)
|
85
|
-
string.slice!(
|
103
|
+
string.slice!('index.html')
|
86
104
|
string
|
87
105
|
end
|
88
106
|
end
|
data/lib/poole/tags.rb
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
# Title: Mr. Poole's Plugin
|
2
|
-
# Author: Ian Carrico
|
2
|
+
# Author: Ian Carrico https://iamcarrico.com
|
3
3
|
# Description: Output a list of metatags for your site.
|
4
4
|
#
|
5
5
|
# Syntax {% poole_tags %}
|
6
6
|
#
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'liquid'
|
9
9
|
require 'date'
|
10
10
|
|
11
11
|
require 'poole/renderer'
|
12
12
|
|
13
13
|
module Jekyll
|
14
14
|
module PoolePlugin
|
15
|
+
# Adding in our class tags.
|
15
16
|
class Tags < Liquid::Tag
|
16
|
-
def initialize(
|
17
|
+
def initialize(_tag_name, text, _tokens)
|
17
18
|
text = text.strip
|
18
|
-
@text = text.empty? ?
|
19
|
+
@text = text.empty? ? 'all' : text
|
19
20
|
end
|
20
21
|
|
21
22
|
def render(context)
|
22
|
-
Renderer.new(context, @markup).
|
23
|
+
Renderer.new(context, @markup).public_send :"render_#{@text}"\
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
data/lib/poole/version.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
#
|
1
|
+
# The version number for Mr. Poole's plugin.
|
2
|
+
# Author: Ian Carrico https://iamcarrico.com
|
3
|
+
# Description: Nothing special here, just a version number.
|
4
|
+
#
|
2
5
|
|
3
6
|
module Jekyll
|
7
|
+
# Just the Poole Plugin.
|
4
8
|
module PoolePlugin
|
5
|
-
VERSION =
|
9
|
+
VERSION = '0.1.0'
|
6
10
|
end
|
7
11
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
_site
|
@@ -0,0 +1,293 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Jekyll::PoolePlugin::Tags do
|
4
|
+
let(:index) { { registers: { site: @site, page: @index_page } } }
|
5
|
+
let(:default) { { registers: { site: @site, page: @default_post } } }
|
6
|
+
let(:custom) { { registers: { site: @site, page: @custom_post } } }
|
7
|
+
let(:page) { { registers: { site: @site, page: @about_page } } }
|
8
|
+
|
9
|
+
def render(content, page)
|
10
|
+
::Liquid::Template.parse(content).render({}, page)
|
11
|
+
end
|
12
|
+
|
13
|
+
def render_meta(property, content)
|
14
|
+
template = Jekyll::PoolePlugin::Renderer.const_get :META_TAG
|
15
|
+
|
16
|
+
format template, property: property, content: content
|
17
|
+
end
|
18
|
+
|
19
|
+
def render_link(rel, href)
|
20
|
+
template = Jekyll::PoolePlugin::Renderer.const_get :LINK_TAG
|
21
|
+
|
22
|
+
format template, rel: rel, href: href
|
23
|
+
end
|
24
|
+
|
25
|
+
context '{% poole_tags <tag> %}' do
|
26
|
+
|
27
|
+
# What values will the index page give?
|
28
|
+
context 'Index page' do
|
29
|
+
context 'site name' do
|
30
|
+
subject { render('{% poole_tags site_name %}', index) }
|
31
|
+
it { is_expected.to eql render_meta('og:site_name', 'Site Name') }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'page title' do
|
35
|
+
subject { render('{% poole_tags title %}', index) }
|
36
|
+
it { is_expected.to eql render_meta('og:title', 'Site Name') }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'type' do
|
40
|
+
subject { render('{% poole_tags type %}', index) }
|
41
|
+
it { is_expected.to eql render_meta('og:type', 'website') }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'description' do
|
45
|
+
subject { render('{% poole_tags description %}', index) }
|
46
|
+
it { is_expected.to be_empty }
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'published_time' do
|
50
|
+
subject { render('{% poole_tags published_time %}', index) }
|
51
|
+
it { is_expected.to be_empty }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'author' do
|
55
|
+
subject { render('{% poole_tags author %}', index) }
|
56
|
+
it do
|
57
|
+
is_expected.to eql render_meta(
|
58
|
+
'article:author',
|
59
|
+
'https://google.com')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'url' do
|
64
|
+
subject { render('{% poole_tags url %}', index) }
|
65
|
+
it do
|
66
|
+
is_expected.to eql render_meta(
|
67
|
+
'og:url', 'https://iamcarrico.com/')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'canonical' do
|
72
|
+
subject { render('{% poole_tags canonical %}', index) }
|
73
|
+
it do
|
74
|
+
is_expected.to eql render_link(
|
75
|
+
'canonical',
|
76
|
+
'https://iamcarrico.com/')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'image' do
|
81
|
+
subject { render('{% poole_tags image %}', index) }
|
82
|
+
it do
|
83
|
+
is_expected.to eql render_meta(
|
84
|
+
'og:image',
|
85
|
+
'https://iamcarrico.com/img/logo.png')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# The values that a default post, without customization will give.
|
91
|
+
context 'Default post' do
|
92
|
+
context 'site name' do
|
93
|
+
subject { render('{% poole_tags site_name %}', default) }
|
94
|
+
it { is_expected.to eql render_meta('og:site_name', 'Site Name') }
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'page title' do
|
98
|
+
subject { render('{% poole_tags title %}', default) }
|
99
|
+
it { is_expected.to eql render_meta('og:title', 'Default Tags') }
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'type' do
|
103
|
+
subject { render('{% poole_tags type %}', default) }
|
104
|
+
it { is_expected.to eql render_meta('og:type', 'article') }
|
105
|
+
end
|
106
|
+
|
107
|
+
context 'description' do
|
108
|
+
subject { render('{% poole_tags description %}', default) }
|
109
|
+
it { is_expected.to be_empty }
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'published_time' do
|
113
|
+
subject { render('{% poole_tags published_time %}', default) }
|
114
|
+
it do
|
115
|
+
is_expected.to eql render_meta(
|
116
|
+
'article:published_time',
|
117
|
+
'2014-11-21T06:00:00-06:00')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'author' do
|
122
|
+
subject { render('{% poole_tags author %}', default) }
|
123
|
+
it do
|
124
|
+
is_expected.to eql render_meta(
|
125
|
+
'article:author',
|
126
|
+
'https://google.com')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context 'url' do
|
131
|
+
subject { render('{% poole_tags url %}', default) }
|
132
|
+
it do
|
133
|
+
is_expected.to eql render_meta(
|
134
|
+
'og:url',
|
135
|
+
'https://iamcarrico.com/2014/11/21/default-tags.html')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'canonical' do
|
140
|
+
subject { render('{% poole_tags canonical %}', default) }
|
141
|
+
it do
|
142
|
+
is_expected.to eql render_link(
|
143
|
+
'canonical',
|
144
|
+
'https://iamcarrico.com/2014/11/21/default-tags.html')
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'image' do
|
149
|
+
subject { render('{% poole_tags image %}', default) }
|
150
|
+
it do
|
151
|
+
is_expected.to eql render_meta(
|
152
|
+
'og:image', 'https://iamcarrico.com/img/logo.png')
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# A custom post, with specific values for each field.
|
158
|
+
context 'Custom post' do
|
159
|
+
context 'site name' do
|
160
|
+
subject { render('{% poole_tags site_name %}', custom) }
|
161
|
+
it { is_expected.to eql render_meta('og:site_name', 'Site Name') }
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'page title' do
|
165
|
+
subject { render('{% poole_tags title %}', custom) }
|
166
|
+
it { is_expected.to eql render_meta('og:title', 'Custom Tags') }
|
167
|
+
end
|
168
|
+
|
169
|
+
context 'type' do
|
170
|
+
subject { render('{% poole_tags type %}', custom) }
|
171
|
+
it { is_expected.to eql render_meta('og:type', 'article') }
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'description' do
|
175
|
+
subject { render('{% poole_tags description %}', custom) }
|
176
|
+
it do
|
177
|
+
is_expected.to eql render_meta(
|
178
|
+
'og:description',
|
179
|
+
'What can Mr. Poole do for you')
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context 'published_time' do
|
184
|
+
subject { render('{% poole_tags published_time %}', custom) }
|
185
|
+
it do
|
186
|
+
is_expected.to eql render_meta(
|
187
|
+
'article:published_time',
|
188
|
+
'2014-11-22T06:00:00-06:00')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context 'author' do
|
193
|
+
subject { render('{% poole_tags author %}', custom) }
|
194
|
+
it do
|
195
|
+
is_expected.to eql render_meta(
|
196
|
+
'article:author',
|
197
|
+
'https://google.com')
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context 'url' do
|
202
|
+
subject { render('{% poole_tags url %}', custom) }
|
203
|
+
it do
|
204
|
+
is_expected.to eql render_meta(
|
205
|
+
'og:url',
|
206
|
+
'https://iamcarrico.com/2014/11/22/what-can-poole-do-for-you.html')
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
context 'canonical' do
|
211
|
+
subject { render('{% poole_tags canonical %}', custom) }
|
212
|
+
it do
|
213
|
+
is_expected.to eql render_link(
|
214
|
+
'canonical',
|
215
|
+
'https://iamcarrico.com/2014/11/22/what-can-poole-do-for-you.html')
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
context 'image' do
|
220
|
+
subject { render('{% poole_tags image %}', custom) }
|
221
|
+
it do
|
222
|
+
is_expected.to eql render_meta(
|
223
|
+
'og:image',
|
224
|
+
'https://iamcarrico.com/img/custom-image.png')
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
# A page being rendered.
|
230
|
+
context 'About page' do
|
231
|
+
context 'site name' do
|
232
|
+
subject { render('{% poole_tags site_name %}', page) }
|
233
|
+
it { is_expected.to eql render_meta('og:site_name', 'Site Name') }
|
234
|
+
end
|
235
|
+
|
236
|
+
context 'page title' do
|
237
|
+
subject { render('{% poole_tags title %}', page) }
|
238
|
+
it { is_expected.to eql render_meta('og:title', 'About Us') }
|
239
|
+
end
|
240
|
+
|
241
|
+
context 'type' do
|
242
|
+
subject { render('{% poole_tags type %}', page) }
|
243
|
+
it { is_expected.to eql render_meta('og:type', 'article') }
|
244
|
+
end
|
245
|
+
|
246
|
+
context 'description' do
|
247
|
+
subject { render('{% poole_tags description %}', page) }
|
248
|
+
it { is_expected.to be_empty }
|
249
|
+
end
|
250
|
+
|
251
|
+
context 'published_time' do
|
252
|
+
subject { render('{% poole_tags published_time %}', page) }
|
253
|
+
it { is_expected.to be_empty }
|
254
|
+
end
|
255
|
+
|
256
|
+
context 'author' do
|
257
|
+
subject { render('{% poole_tags author %}', page) }
|
258
|
+
it do
|
259
|
+
is_expected.to eql render_meta(
|
260
|
+
'article:author',
|
261
|
+
'https://google.com')
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
context 'url' do
|
266
|
+
subject { render('{% poole_tags url %}', page) }
|
267
|
+
it do
|
268
|
+
is_expected.to eql render_meta(
|
269
|
+
'og:url',
|
270
|
+
'https://iamcarrico.com/about.html')
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context 'canonical' do
|
275
|
+
subject { render('{% poole_tags canonical %}', page) }
|
276
|
+
it do
|
277
|
+
is_expected.to eql render_link(
|
278
|
+
'canonical',
|
279
|
+
'https://iamcarrico.com/about.html')
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
context 'image' do
|
284
|
+
subject { render('{% poole_tags image %}', page) }
|
285
|
+
it do
|
286
|
+
is_expected.to eql render_meta(
|
287
|
+
'og:image',
|
288
|
+
'https://iamcarrico.com/img/logo.png')
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
require 'coveralls'
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter
|
8
|
+
]
|
9
|
+
|
10
|
+
SimpleCov.start
|
11
|
+
|
12
|
+
require 'jekyll'
|
13
|
+
require 'liquid'
|
14
|
+
require 'sprockets'
|
15
|
+
|
16
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
17
|
+
# in spec/support/ and its subdirectories.
|
18
|
+
Dir[File.expand_path('../support', __FILE__) + '/**/*.rb']
|
19
|
+
.each { |f| require f }
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
config.include FixturesHelpers
|
23
|
+
config.extend FixturesHelpers
|
24
|
+
|
25
|
+
config.disable_monkey_patching!
|
26
|
+
|
27
|
+
config.before(:all) do
|
28
|
+
if Gem::Version.new('2') <= Gem::Version.new(Jekyll::VERSION)
|
29
|
+
Jekyll.logger.log_level = :warn
|
30
|
+
else
|
31
|
+
Jekyll.logger.log_level = Jekyll::Stevenson::WARN
|
32
|
+
end
|
33
|
+
|
34
|
+
@dest = fixtures_path.join('_site')
|
35
|
+
@site = Jekyll::Site.new(Jekyll.configuration(
|
36
|
+
'source' => fixtures_path.to_s,
|
37
|
+
'destination' => @dest.to_s
|
38
|
+
))
|
39
|
+
|
40
|
+
@index_page = Jekyll::Page.new(
|
41
|
+
@site,
|
42
|
+
fixtures_path.to_s,
|
43
|
+
'',
|
44
|
+
'index.html'
|
45
|
+
)
|
46
|
+
|
47
|
+
@about_page = Jekyll::Page.new(
|
48
|
+
@site,
|
49
|
+
fixtures_path.to_s,
|
50
|
+
'',
|
51
|
+
'about.md'
|
52
|
+
)
|
53
|
+
|
54
|
+
@default_post = Jekyll::Post.new(
|
55
|
+
@site,
|
56
|
+
fixtures_path.to_s,
|
57
|
+
'',
|
58
|
+
'2014-11-21-default-tags.md'
|
59
|
+
)
|
60
|
+
|
61
|
+
@custom_post = Jekyll::Post.new(
|
62
|
+
@site,
|
63
|
+
fixtures_path.to_s,
|
64
|
+
'',
|
65
|
+
'2014-11-22-what-can-poole-do-for-you.md'
|
66
|
+
)
|
67
|
+
|
68
|
+
@dest.rmtree if @dest.exist?
|
69
|
+
@site.process
|
70
|
+
end
|
71
|
+
|
72
|
+
config.after(:all) do
|
73
|
+
@dest.rmtree if @dest.exist?
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-poole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Carrico
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -53,11 +53,31 @@ extensions: []
|
|
53
53
|
extra_rdoc_files: []
|
54
54
|
files:
|
55
55
|
- .gitignore
|
56
|
+
- .rspec
|
57
|
+
- .rubocop.yml
|
58
|
+
- .rubocop_todo.yml
|
59
|
+
- .travis.yml
|
60
|
+
- Gemfile
|
61
|
+
- Guardfile
|
62
|
+
- LICENSE
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
56
65
|
- jekyll-poole.gemspec
|
57
66
|
- lib/jekyll-poole.rb
|
58
67
|
- lib/poole/renderer.rb
|
59
68
|
- lib/poole/tags.rb
|
60
69
|
- lib/poole/version.rb
|
70
|
+
- spec/fixtures/.gitignore
|
71
|
+
- spec/fixtures/_config.yml
|
72
|
+
- spec/fixtures/_layouts/default.md
|
73
|
+
- spec/fixtures/_layouts/post.md
|
74
|
+
- spec/fixtures/_posts/2014-11-21-default-tags.md
|
75
|
+
- spec/fixtures/_posts/2014-11-22-what-can-poole-do-for-you.md
|
76
|
+
- spec/fixtures/about.md
|
77
|
+
- spec/fixtures/index.html
|
78
|
+
- spec/lib/tags_spec.rb
|
79
|
+
- spec/spec_helper.rb
|
80
|
+
- spec/support/fixture_helpers.rb
|
61
81
|
homepage: http://www.github.com/iamcarrico/jekyll-poole-tags
|
62
82
|
licenses:
|
63
83
|
- MIT
|
@@ -81,5 +101,16 @@ rubyforge_project:
|
|
81
101
|
rubygems_version: 2.0.14
|
82
102
|
signing_key:
|
83
103
|
specification_version: 4
|
84
|
-
summary: jekyll-poole-tags
|
85
|
-
test_files:
|
104
|
+
summary: jekyll-poole-tags-#{Jekyll::PoolePlugin::VERSION}
|
105
|
+
test_files:
|
106
|
+
- spec/fixtures/.gitignore
|
107
|
+
- spec/fixtures/_config.yml
|
108
|
+
- spec/fixtures/_layouts/default.md
|
109
|
+
- spec/fixtures/_layouts/post.md
|
110
|
+
- spec/fixtures/_posts/2014-11-21-default-tags.md
|
111
|
+
- spec/fixtures/_posts/2014-11-22-what-can-poole-do-for-you.md
|
112
|
+
- spec/fixtures/about.md
|
113
|
+
- spec/fixtures/index.html
|
114
|
+
- spec/lib/tags_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/support/fixture_helpers.rb
|