octopress-filters 1.2.0 → 1.2.2
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/CHANGELOG.md +8 -0
- data/README.md +48 -25
- data/lib/octopress-filters.rb +26 -6
- data/lib/octopress-filters/version.rb +2 -4
- metadata +8 -55
- data/.gitignore +0 -23
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/Rakefile +0 -2
- data/octopress-filters.gemspec +0 -30
- data/test/.clash.yml +0 -2
- data/test/Gemfile +0 -7
- data/test/_config.yml +0 -15
- data/test/_expected/canonical.html +0 -4
- data/test/_expected/classify.html +0 -5
- data/test/_expected/compact_newlines.html +0 -6
- data/test/_expected/full_urls.html +0 -2
- data/test/_expected/join_lines.html +0 -2
- data/test/_expected/smartquotes.html +0 -27
- data/test/_expected/strip_url_protocol.html +0 -2
- data/test/_expected/titlecase.html +0 -1
- data/test/_expected/unorphan.html +0 -1
- data/test/canonical.html +0 -6
- data/test/classify.html +0 -7
- data/test/compact_newlines.html +0 -15
- data/test/full_urls.html +0 -6
- data/test/join_lines.html +0 -9
- data/test/smartquotes.html +0 -31
- data/test/strip_url_protocol.html +0 -6
- data/test/titlecase.html +0 -5
- data/test/unorphan.html +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c03a48072acdfaa98fc2e5df1a3762bcdf35e40
|
4
|
+
data.tar.gz: 5d4a041d2041a0d07fe96d63a63af55c9c0e6582
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71dd711640a5c418a61b37693be4aa5b8c5799d79c1b1500dc1bc5c324337ad87de3d0585a62df87b08dd73f29485103226b4f776bdec440ab53accca5dc60a9
|
7
|
+
data.tar.gz: 93532fdce07a3ae9e072b7aa002b3dd6168468d6b95abdea56352e66db7845310b560610ff0d40a344454056cb830b0c6af67cc8e08a6130aa53334ca8640782
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -20,22 +20,24 @@ A set of handy liquid filters used by Octopress.
|
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
23
|
-
|
23
|
+
If you're using bundler add this gem to your site's Gemfile in the `:jekyll_plugins` group:
|
24
24
|
|
25
|
-
|
25
|
+
group :jekyll_plugins do
|
26
|
+
gem 'octopress-filters'
|
27
|
+
end
|
26
28
|
|
27
|
-
|
29
|
+
Then install the gem with Bundler
|
28
30
|
|
29
31
|
$ bundle
|
30
32
|
|
31
|
-
|
33
|
+
To install manually without bundler:
|
32
34
|
|
33
35
|
$ gem install octopress-filters
|
34
36
|
|
35
|
-
|
37
|
+
Then add the gem to your Jekyll configuration.
|
36
38
|
|
37
39
|
gems:
|
38
|
-
-
|
40
|
+
-octopress-filters
|
39
41
|
|
40
42
|
## Examples
|
41
43
|
|
@@ -44,7 +46,9 @@ Next add it to your gems list in Jekyll's `_config.yml`
|
|
44
46
|
Any relative links in your site will be expanded with the `url` configuration in Jekyll's `_config.yml`. This filter only affects urls
|
45
47
|
beginning with `/` inside of `href` or `src` attributes.
|
46
48
|
|
47
|
-
|
49
|
+
```
|
50
|
+
{{ post.content | full_urls }}
|
51
|
+
```
|
48
52
|
|
49
53
|
You might use this if you're working on an RSS feed, you'll need to be sure all relative urls in your content are expanded to full urls.
|
50
54
|
|
@@ -52,51 +56,70 @@ You might use this if you're working on an RSS feed, you'll need to be sure all
|
|
52
56
|
|
53
57
|
This filter prepends input with the `url` configuration in Jekyll's `_config.yml`.
|
54
58
|
|
55
|
-
|
59
|
+
```
|
60
|
+
{{ post.url | full_url }}
|
61
|
+
```
|
56
62
|
|
57
63
|
### Canonical url
|
58
64
|
|
59
65
|
This filter expands the url to be a full url, then removes "index.html" if it is present. Here are some examples.
|
60
66
|
|
61
|
-
|
62
|
-
|
63
|
-
|
67
|
+
```
|
68
|
+
{{ "about/index.html" | canonical_url }} //=> http://example.com/about/
|
69
|
+
{{ "about.html" | canonical_url }} //=> http://example.com/about.html
|
70
|
+
{{ "/" | canonical_url }} //=> http://example.com/
|
71
|
+
|
72
|
+
```
|
64
73
|
|
65
74
|
### Titlecase
|
66
75
|
|
67
|
-
|
76
|
+
```
|
77
|
+
{{ post.title | titlecase }} //=> This Is a Properly Capitalized Title
|
78
|
+
```
|
68
79
|
|
69
80
|
### Smartquote
|
70
81
|
|
71
|
-
|
82
|
+
```
|
83
|
+
{{ post.content | smartquotes }}
|
84
|
+
```
|
72
85
|
|
73
86
|
### Unorphan
|
74
87
|
|
75
|
-
|
88
|
+
```
|
89
|
+
{{ post.title | unorphan }} //=> This Is a Properly Capitalized Title
|
90
|
+
```
|
76
91
|
|
77
92
|
### Sluggify/Classify
|
78
93
|
|
79
|
-
|
94
|
+
```
|
95
|
+
<article class="{{ post.class | classify }}">
|
96
|
+
```
|
80
97
|
|
81
98
|
### Compact newlines
|
82
99
|
|
83
|
-
|
100
|
+
```
|
101
|
+
{{ content | compact_newlines }}
|
102
|
+
```
|
84
103
|
|
85
104
|
### Join lines
|
86
105
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
106
|
+
```
|
107
|
+
{% capture page_title %}
|
108
|
+
{{ page.title }}
|
109
|
+
{{ site.header.title }}
|
110
|
+
{% endcapture %}
|
91
111
|
|
92
|
-
|
93
|
-
|
94
|
-
|
112
|
+
<head>
|
113
|
+
<title>{{ page_title | join_lines: " - " }}</title>
|
114
|
+
…
|
115
|
+
```
|
95
116
|
|
96
117
|
### Strip url protocol
|
97
118
|
|
98
|
-
|
99
|
-
|
119
|
+
```
|
120
|
+
{{ site.url }} # https://some-site.com/
|
121
|
+
{{ site.url | strip_url_protocol }} # some-site.com/
|
122
|
+
```
|
100
123
|
|
101
124
|
## Contributing
|
102
125
|
|
data/lib/octopress-filters.rb
CHANGED
@@ -13,15 +13,15 @@ module Octopress
|
|
13
13
|
# Returns the site's config root or '/' if the config isn't set
|
14
14
|
#
|
15
15
|
def root
|
16
|
-
|
17
|
-
|
16
|
+
baseurl = Octopress.site.config['baseurl'] || Octopress.site.config['root']
|
17
|
+
baseurl.nil? ? '/' : File.join('/', baseurl)
|
18
18
|
end
|
19
19
|
|
20
20
|
def site_url
|
21
21
|
@url ||= begin
|
22
|
-
Octopress.site.config['url']
|
22
|
+
File.join(Octopress.site.config['url'], root)
|
23
23
|
rescue
|
24
|
-
raise IOError.new "Please add your site's published url to your _config.yml, eg url: http://example.com
|
24
|
+
raise IOError.new "Please add your site's published url to your _config.yml, eg url: http://example.com"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -65,7 +65,7 @@ module Octopress
|
|
65
65
|
# Convert url input into a standard canonical url
|
66
66
|
#
|
67
67
|
def canonical_url(input)
|
68
|
-
full_url(input).downcase.sub(/index
|
68
|
+
full_url(input).downcase.sub(/index\.\w+$/i, '')
|
69
69
|
end
|
70
70
|
|
71
71
|
# Prepend all urls with the full site url
|
@@ -99,11 +99,20 @@ module Octopress
|
|
99
99
|
#
|
100
100
|
def expand_url(input, url=nil)
|
101
101
|
url ||= root
|
102
|
-
if input =~ /^#{url}/
|
102
|
+
url = if input =~ /^#{url}/
|
103
103
|
input
|
104
104
|
else
|
105
105
|
File.join(url, input)
|
106
106
|
end
|
107
|
+
|
108
|
+
# If url has a file.extension
|
109
|
+
if url =~ /\.\w+$/
|
110
|
+
url
|
111
|
+
else
|
112
|
+
# The url ends with a directory
|
113
|
+
# Add trailing slash if necessary
|
114
|
+
File.join(url, '/')
|
115
|
+
end
|
107
116
|
end
|
108
117
|
|
109
118
|
# Prepend all absolute urls with a url fragment
|
@@ -133,3 +142,14 @@ end
|
|
133
142
|
|
134
143
|
|
135
144
|
Liquid::Template.register_filter Octopress::Filters
|
145
|
+
|
146
|
+
if defined? Octopress::Docs
|
147
|
+
Octopress::Docs.add({
|
148
|
+
name: "Octopress Filters",
|
149
|
+
gem: "octopress-filters",
|
150
|
+
version: Octopress::Filters::VERSION,
|
151
|
+
description: "A set of nice liquid filters used by Octopress",
|
152
|
+
path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
|
153
|
+
source_url: "https://github.com/octopress/filters"
|
154
|
+
})
|
155
|
+
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.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -112,55 +112,29 @@ dependencies:
|
|
112
112
|
name: octopress-filter-tag
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
125
|
-
description:
|
124
|
+
version: '0'
|
125
|
+
description:
|
126
126
|
email:
|
127
127
|
- brandon@imathis.com
|
128
128
|
executables: []
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
- ".gitignore"
|
133
|
-
- ".travis.yml"
|
134
132
|
- CHANGELOG.md
|
135
|
-
- Gemfile
|
136
133
|
- LICENSE.txt
|
137
134
|
- README.md
|
138
|
-
- Rakefile
|
139
135
|
- lib/octopress-filters.rb
|
140
136
|
- lib/octopress-filters/hooks.rb
|
141
137
|
- lib/octopress-filters/version.rb
|
142
|
-
- octopress-filters.gemspec
|
143
|
-
- test/.clash.yml
|
144
|
-
- test/Gemfile
|
145
|
-
- test/_config.yml
|
146
|
-
- test/_expected/canonical.html
|
147
|
-
- test/_expected/classify.html
|
148
|
-
- test/_expected/compact_newlines.html
|
149
|
-
- test/_expected/full_urls.html
|
150
|
-
- test/_expected/join_lines.html
|
151
|
-
- test/_expected/smartquotes.html
|
152
|
-
- test/_expected/strip_url_protocol.html
|
153
|
-
- test/_expected/titlecase.html
|
154
|
-
- test/_expected/unorphan.html
|
155
|
-
- test/canonical.html
|
156
|
-
- test/classify.html
|
157
|
-
- test/compact_newlines.html
|
158
|
-
- test/full_urls.html
|
159
|
-
- test/join_lines.html
|
160
|
-
- test/smartquotes.html
|
161
|
-
- test/strip_url_protocol.html
|
162
|
-
- test/titlecase.html
|
163
|
-
- test/unorphan.html
|
164
138
|
homepage: https://github.com/octopress/filters
|
165
139
|
licenses:
|
166
140
|
- MIT
|
@@ -185,25 +159,4 @@ rubygems_version: 2.2.2
|
|
185
159
|
signing_key:
|
186
160
|
specification_version: 4
|
187
161
|
summary: A set of handy liquid filters used by Octopress
|
188
|
-
test_files:
|
189
|
-
- test/.clash.yml
|
190
|
-
- test/Gemfile
|
191
|
-
- test/_config.yml
|
192
|
-
- test/_expected/canonical.html
|
193
|
-
- test/_expected/classify.html
|
194
|
-
- test/_expected/compact_newlines.html
|
195
|
-
- test/_expected/full_urls.html
|
196
|
-
- test/_expected/join_lines.html
|
197
|
-
- test/_expected/smartquotes.html
|
198
|
-
- test/_expected/strip_url_protocol.html
|
199
|
-
- test/_expected/titlecase.html
|
200
|
-
- test/_expected/unorphan.html
|
201
|
-
- test/canonical.html
|
202
|
-
- test/classify.html
|
203
|
-
- test/compact_newlines.html
|
204
|
-
- test/full_urls.html
|
205
|
-
- test/join_lines.html
|
206
|
-
- test/smartquotes.html
|
207
|
-
- test/strip_url_protocol.html
|
208
|
-
- test/titlecase.html
|
209
|
-
- test/unorphan.html
|
162
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
23
|
-
_site
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/octopress-filters.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'octopress-filters/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "octopress-filters"
|
8
|
-
spec.version = Octopress::Tags::Filters::VERSION
|
9
|
-
spec.authors = ["Brandon Mathis"]
|
10
|
-
spec.email = ["brandon@imathis.com"]
|
11
|
-
spec.summary = %q{A set of handy liquid filters used by Octopress}
|
12
|
-
spec.description = %q{A set of handy liquid filters used by Octopress}
|
13
|
-
spec.homepage = "https://github.com/octopress/filters"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_runtime_dependency "jekyll"
|
22
|
-
spec.add_runtime_dependency "rubypants-unicode"
|
23
|
-
spec.add_runtime_dependency "titlecase"
|
24
|
-
spec.add_runtime_dependency "octopress-hooks", "~> 2.0"
|
25
|
-
|
26
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
27
|
-
spec.add_development_dependency "rake"
|
28
|
-
spec.add_development_dependency "clash"
|
29
|
-
spec.add_development_dependency "octopress-filter-tag", "~> 1.0"
|
30
|
-
end
|
data/test/.clash.yml
DELETED
data/test/Gemfile
DELETED
data/test/_config.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# Site settings
|
2
|
-
title: Your awesome title
|
3
|
-
email: your-email@domain.com
|
4
|
-
baseurl: ""
|
5
|
-
url: "http://yourdomain.com"
|
6
|
-
timezone: UTC
|
7
|
-
|
8
|
-
exclude:
|
9
|
-
- Gemfile*
|
10
|
-
|
11
|
-
# Build settings
|
12
|
-
markdown: kramdown
|
13
|
-
gems:
|
14
|
-
- octopress-filters
|
15
|
-
- octopress-filter-tag
|
@@ -1,27 +0,0 @@
|
|
1
|
-
“A first example”
|
2
|
-
“A first “nested” example”
|
3
|
-
”.
|
4
|
-
“a
|
5
|
-
’.
|
6
|
-
‘a
|
7
|
-
<p>He said, “‘Quoted’ words in a larger quote.”</p>
|
8
|
-
“I like the 70’s”
|
9
|
-
“I like the ’70s”
|
10
|
-
“I like the ‘70!”
|
11
|
-
|
12
|
-
pre”post
|
13
|
-
pre “post
|
14
|
-
pre “post
|
15
|
-
pre–“post
|
16
|
-
pre–”!
|
17
|
-
|
18
|
-
pre’post
|
19
|
-
pre ‘post
|
20
|
-
pre ‘post
|
21
|
-
pre–‘post
|
22
|
-
pre–’!
|
23
|
-
<b>‘</b>
|
24
|
-
foo<b>’</b>
|
25
|
-
|
26
|
-
<pre>"this shouldn't be curled"</pre>
|
27
|
-
<code>"this shouldn't be curled"</code>
|
@@ -1 +0,0 @@
|
|
1
|
-
This Title Could Use Some Capitals
|
@@ -1 +0,0 @@
|
|
1
|
-
This title is long so it might wrap
|
data/test/canonical.html
DELETED
data/test/classify.html
DELETED
data/test/compact_newlines.html
DELETED
data/test/full_urls.html
DELETED
data/test/join_lines.html
DELETED
data/test/smartquotes.html
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
---
|
2
|
-
---
|
3
|
-
{% filter smartquotes %}
|
4
|
-
"A first example"
|
5
|
-
"A first "nested" example"
|
6
|
-
".
|
7
|
-
"a
|
8
|
-
'.
|
9
|
-
'a
|
10
|
-
<p>He said, "'Quoted' words in a larger quote."</p>
|
11
|
-
"I like the 70's"
|
12
|
-
"I like the '70s"
|
13
|
-
"I like the '70!"
|
14
|
-
|
15
|
-
pre"post
|
16
|
-
pre "post
|
17
|
-
pre "post
|
18
|
-
pre--"post
|
19
|
-
pre--"!
|
20
|
-
|
21
|
-
pre'post
|
22
|
-
pre 'post
|
23
|
-
pre 'post
|
24
|
-
pre--'post
|
25
|
-
pre--'!
|
26
|
-
<b>'</b>
|
27
|
-
foo<b>'</b>
|
28
|
-
|
29
|
-
<pre>"this shouldn't be curled"</pre>
|
30
|
-
<code>"this shouldn't be curled"</code>
|
31
|
-
{% endfilter %}
|
data/test/titlecase.html
DELETED