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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47d40082d204354809525e9551ddbd6eab622278
4
- data.tar.gz: f67ec62b70dfad459b14250060562daedfaf762c
3
+ metadata.gz: 2c03a48072acdfaa98fc2e5df1a3762bcdf35e40
4
+ data.tar.gz: 5d4a041d2041a0d07fe96d63a63af55c9c0e6582
5
5
  SHA512:
6
- metadata.gz: 423d42bc07b4525ffb331d9665b721eae432b8fe88d090c5c19b9d12406c17705e550fbddc5fce5f1807f046ad3d7ee1d9162b01e0338a3eaf00bedf0afe2f91
7
- data.tar.gz: 010ce83f7446fa3d690e3e20ed85088f708e110d07fbfd56ebf254be3b0367ebb32ebb5bbd9e41062ba8271ba3980dc2d81ef09cdc83a9b97901008e727c6ac5
6
+ metadata.gz: 71dd711640a5c418a61b37693be4aa5b8c5799d79c1b1500dc1bc5c324337ad87de3d0585a62df87b08dd73f29485103226b4f776bdec440ab53accca5dc60a9
7
+ data.tar.gz: 93532fdce07a3ae9e072b7aa002b3dd6168468d6b95abdea56352e66db7845310b560610ff0d40a344454056cb830b0c6af67cc8e08a6130aa53334ca8640782
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.2.2 - 2015-01-23
4
+
5
+ - Added support for baseurl
6
+
7
+ ### 1.2.1 - 2015-01-11
8
+
9
+ - Added support for Octopress docs
10
+
3
11
  ### 1.2.0 - 2014-08-31
4
12
 
5
13
  - Added `strip_url_protocol` which converts `http://bog.com` to `blog.com`.
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
- Add this line to your application's Gemfile:
23
+ If you're using bundler add this gem to your site's Gemfile in the `:jekyll_plugins` group:
24
24
 
25
- gem 'octopress-filters'
25
+ group :jekyll_plugins do
26
+ gem 'octopress-filters'
27
+ end
26
28
 
27
- And then execute:
29
+ Then install the gem with Bundler
28
30
 
29
31
  $ bundle
30
32
 
31
- Or install it yourself as:
33
+ To install manually without bundler:
32
34
 
33
35
  $ gem install octopress-filters
34
36
 
35
- Next add it to your gems list in Jekyll's `_config.yml`
37
+ Then add the gem to your Jekyll configuration.
36
38
 
37
39
  gems:
38
- - octopress-filters
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
- {{ post.content | full_urls }}
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
- {{ post.url | full_url }}
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
- {{ "about/index.html" | canonical_url }} //=> http://example.com/about/
62
- {{ "about.html" | canonical_url }} //=> http://example.com/about.html
63
- {{ "/" | canonical_url }} //=> http://example.com/
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
- {{ post.title | titlecase }} //=> This Is a Properly Capitalized Title
76
+ ```
77
+ {{ post.title | titlecase }} //=> This Is a Properly Capitalized Title
78
+ ```
68
79
 
69
80
  ### Smartquote
70
81
 
71
- {{ post.content | smartquotes }}
82
+ ```
83
+ {{ post.content | smartquotes }}
84
+ ```
72
85
 
73
86
  ### Unorphan
74
87
 
75
- {{ post.title | unorphan }} //=> This Is a Properly Capitalized Title
88
+ ```
89
+ {{ post.title | unorphan }} //=> This Is a Properly Capitalized Title
90
+ ```
76
91
 
77
92
  ### Sluggify/Classify
78
93
 
79
- <article class="{{ post.class | classify }}">
94
+ ```
95
+ <article class="{{ post.class | classify }}">
96
+ ```
80
97
 
81
98
  ### Compact newlines
82
99
 
83
- {{ content | compact_newlines }}
100
+ ```
101
+ {{ content | compact_newlines }}
102
+ ```
84
103
 
85
104
  ### Join lines
86
105
 
87
- {% capture page_title %}
88
- {{ page.title }}
89
- {{ site.header.title }}
90
- {% endcapture %}
106
+ ```
107
+ {% capture page_title %}
108
+ {{ page.title }}
109
+ {{ site.header.title }}
110
+ {% endcapture %}
91
111
 
92
- <head>
93
- <title>{{ page_title | join_lines: " - " }}</title>
94
-
112
+ <head>
113
+ <title>{{ page_title | join_lines: " - " }}</title>
114
+
115
+ ```
95
116
 
96
117
  ### Strip url protocol
97
118
 
98
- {{ site.url }} # https://some-site.com/
99
- {{ site.url | strip_url_protocol }} # some-site.com/
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
 
@@ -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
- root_url = Octopress.site.config['root']
17
- root_url.nil? ? '/' : File.join('/', root_url)
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\.html/, '')
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
@@ -1,7 +1,5 @@
1
1
  module Octopress
2
- module Tags
3
- module Filters
4
- VERSION = "1.2.0"
5
- end
2
+ module Filters
3
+ VERSION = "1.2.2"
6
4
  end
7
5
  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.0
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: 2014-09-01 00:00:00.000000000 Z
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: '1.0'
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: '1.0'
125
- description: A set of handy liquid filters used by Octopress
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
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- script: cd test && bundle exec clash
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in octopress_render_tag.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
@@ -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
@@ -1,2 +0,0 @@
1
- build: true
2
- compare: _expected _site
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'octopress-filters', path: '../'
4
- gem 'pry-debugger'
5
- gem 'octopress-filter-tag'
6
- gem 'rubypants'
7
- gem 'clash'
@@ -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,4 +0,0 @@
1
- http://yourdomain.com/canonical.html
2
- http://yourdomain.com/
3
- http://yourdomain.com/foo/
4
- http://yourdomain.com/foo/
@@ -1,5 +0,0 @@
1
-
2
-
3
- <div class="this-is-a-silly-classname"></div>
4
- <div class="this-is-a-silly-classname"></div>
5
-
@@ -1,6 +0,0 @@
1
- There
2
- Is
3
- A
4
- Lot
5
- Of
6
- Whitespace
@@ -1,2 +0,0 @@
1
- <a href="http://yourdomain.com/about">About</a>
2
- <script src="http://yourdomain.com/javascripts/foo.js"></script>
@@ -1,2 +0,0 @@
1
- this,has,commas,man
2
-
@@ -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&nbsp;“post
15
- pre–“post
16
- pre–”!
17
-
18
- pre’post
19
- pre ‘post
20
- pre&nbsp;‘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,2 +0,0 @@
1
- yourdomain.com
2
- foo.bar.com/goggles
@@ -1 +0,0 @@
1
- This Title Could Use Some Capitals
@@ -1 +0,0 @@
1
- This title is long so it might&nbsp;wrap
@@ -1,6 +0,0 @@
1
- ---
2
- ---
3
- {{ page.url | canonical_url }}
4
- {{ "/index.html" | canonical_url }}
5
- {{ "foo/index.html" | canonical_url }}
6
- {{ "/foo/index.html" | canonical_url }}
@@ -1,7 +0,0 @@
1
- ---
2
- ---
3
- {% assign class = "this is a silly classname" %}
4
-
5
- <div class="{{ class | classify }}"></div>
6
- <div class="{{ class | sluggify }}"></div>
7
-
@@ -1,15 +0,0 @@
1
- ---
2
- ---
3
- {% filter compact_newlines %}
4
- There
5
-
6
- Is
7
-
8
- A
9
-
10
- Lot
11
-
12
- Of
13
-
14
- Whitespace
15
- {% endfilter %}
@@ -1,6 +0,0 @@
1
- ---
2
- ---
3
- {% filter full_urls %}
4
- <a href="/about">About</a>
5
- <script src="/javascripts/foo.js"></script>
6
- {% endfilter %}
@@ -1,9 +0,0 @@
1
- ---
2
- ---
3
- {% filter join_lines: ',' %}
4
- this
5
- has
6
- commas
7
- man
8
- {% endfilter %}
9
-
@@ -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&nbsp;"post
18
- pre--"post
19
- pre--"!
20
-
21
- pre'post
22
- pre 'post
23
- pre&nbsp;'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 %}
@@ -1,6 +0,0 @@
1
- ---
2
- ---
3
- {{ site.url | strip_url_protocol }}
4
- {% filter strip_url_protocol %}
5
- https://foo.bar.com/goggles
6
- {% endfilter %}
@@ -1,5 +0,0 @@
1
- ---
2
- title: this title could use some capitals
3
- ---
4
-
5
- {{ page.title | titlecase }}
@@ -1,5 +0,0 @@
1
- ---
2
- title: This title is long so it might wrap
3
- ---
4
-
5
- {{ page.title | unorphan }}