octopress-filters 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +4 -4
- data/lib/octopress-filters.rb +8 -1
- data/lib/octopress-filters/hooks.rb +23 -9
- data/lib/octopress-filters/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b89e6bb9ddb38a587f20569c35214b0e61605f2
|
4
|
+
data.tar.gz: b8baba15a0505b827437e1657a027efca92c464e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f3b4048f7e57648abee31b0a2cc0159bfc7ce5d3fee011d0fef1efb332e3bb255a80830dd1dea61f2134bae1214ebfc519ab077332003b1533eae4cf65e1d8
|
7
|
+
data.tar.gz: 611001cd34485076df6cabf7e0abacc64fe809344d8ee9a232e33ffab32d2c5baf119e4f60f340cb5693bb0389c40b2e93bcd917e6bb3700a76901ada4bdd53f
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 1.4.0 - 2015-08-31
|
4
|
+
|
5
|
+
- Added support for Jekyll 3 with Jekyll::Hooks.
|
6
|
+
- Minor: Added `main_url` filter which converts "https://foo.com/bar" to "foo.com"
|
7
|
+
|
3
8
|
### 1.3.3 - 2015-02-28
|
4
9
|
|
5
|
-
- Minor Change: Do not
|
10
|
+
- Minor Change: Do not downcase canonical URLs as authors may not have control over URL case.
|
6
11
|
|
7
12
|
### 1.3.2 - 2015-02-14
|
8
13
|
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Octopress Filters
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/octopress/filters.svg)](https://travis-ci.org/octopress/filters)
|
4
|
+
[![Gem Version](http://img.shields.io/gem/v/octopress-filters.svg)](https://rubygems.org/gems/octopress-filters)
|
5
|
+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://octopress.mit-license.org)
|
6
|
+
|
3
7
|
A set of handy liquid filters used by Octopress.
|
4
8
|
|
5
9
|
- full_urls - Replace relative URLs with absolute URLs (searches for `href` and `src` properties).
|
@@ -16,10 +20,6 @@ A set of handy liquid filters used by Octopress.
|
|
16
20
|
|
17
21
|
Also, not a filter, but this adds `excerpted` (true/false) to post's data. Meaning you can use `{% if post.excerpted %}` in a post loop.
|
18
22
|
|
19
|
-
[![Build Status](https://travis-ci.org/octopress/filters.svg)](https://travis-ci.org/octopress/filters)
|
20
|
-
[![Gem Version](http://img.shields.io/gem/v/octopress-filters.svg)](https://rubygems.org/gems/octopress-filters)
|
21
|
-
[![License](http://img.shields.io/:license-mit-blue.svg)](http://octopress.mit-license.org)
|
22
|
-
|
23
23
|
## Installation
|
24
24
|
|
25
25
|
If you're using bundler add this gem to your site's Gemfile in the `:jekyll_plugins` group:
|
data/lib/octopress-filters.rb
CHANGED
@@ -159,8 +159,15 @@ module Octopress
|
|
159
159
|
input.sub(/\w+?:\/\//,'')
|
160
160
|
end
|
161
161
|
|
162
|
+
# Removes protocol, the first trailing slash and everything after
|
163
|
+
# e.g. https://foo.com/bar -> foo.com
|
164
|
+
#
|
165
|
+
def main_url(input)
|
166
|
+
strip_url_protocol(input).split('/').first
|
167
|
+
end
|
168
|
+
|
162
169
|
module_function *instance_methods
|
163
|
-
public *private_instance_methods.reject!{ |m| [:root].include?(m) }
|
170
|
+
public *private_instance_methods.reject!{ |m| [:site, :root, :baseurl, :strip_baseurls, :site_url].include?(m) }
|
164
171
|
|
165
172
|
|
166
173
|
end
|
@@ -1,18 +1,32 @@
|
|
1
|
-
require 'octopress-hooks'
|
2
|
-
|
3
1
|
module Octopress
|
4
2
|
module Filters
|
5
3
|
|
6
|
-
|
7
|
-
|
4
|
+
if defined?(Jekyll::Hooks)
|
5
|
+
|
6
|
+
Jekyll::Hooks.register :site, :post_read do |site|
|
8
7
|
Octopress::Filters.site = site
|
9
8
|
end
|
10
|
-
|
11
|
-
|
12
|
-
class PostHooks < Hooks::Post
|
13
|
-
def pre_render(post)
|
9
|
+
|
10
|
+
Jekyll::Hooks.register :post, :pre_render do |post, payload|
|
14
11
|
excerpted = post.content.match(post.site.config['excerpt_separator'])
|
15
|
-
|
12
|
+
payload['excerpted'] = !!excerpted
|
13
|
+
end
|
14
|
+
|
15
|
+
else
|
16
|
+
|
17
|
+
require 'octopress-hooks'
|
18
|
+
|
19
|
+
class SiteGrabber < Hooks::Site
|
20
|
+
def post_read(site)
|
21
|
+
Octopress::Filters.site = site
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class PostHooks < Hooks::Post
|
26
|
+
def pre_render(post)
|
27
|
+
excerpted = post.content.match(post.site.config['excerpt_separator'])
|
28
|
+
post.data.merge!({'excerpted' => !!excerpted})
|
29
|
+
end
|
16
30
|
end
|
17
31
|
end
|
18
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-filters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.4.5
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: A set of handy liquid filters used by Octopress
|