jekyll-slugify_underscore 0.0.1
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 +7 -0
- data/.gitignore +5 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +27 -0
- data/Rakefile +6 -0
- data/jekyll-slugify_underscore.gemspec +26 -0
- data/lib/jekyll/.DS_Store +0 -0
- data/lib/jekyll/slugify_underscore.rb +57 -0
- data/lib/jekyll/slugify_underscore/version.rb +5 -0
- data/script/bootstrap +3 -0
- data/script/cibuild +3 -0
- data/script/console +34 -0
- data/script/release +7 -0
- data/spec/fixtures/_config.yml +9 -0
- data/spec/fixtures/_layouts/some_default.html +5 -0
- data/spec/fixtures/index.html +5 -0
- data/spec/jekyll-slugify_underscore_spec.rb +24 -0
- data/spec/spec_helper.rb +21 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 388ef81d823b79a183bbefd425ac0f0a00fc39e0
|
4
|
+
data.tar.gz: 0e9410cdf16cbf25b3061f21b0b0e658039e3c53
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 79f35ad015c27add8466eaa0a53f46126ad894e2cebcd4388dea036a737da594e49a71d71445f7c592e3ac66358af2259182aade9893264907356c9ccd52ccc7
|
7
|
+
data.tar.gz: 34f43475ee7147646905dcd6e7c58f7f997f7cb0cd03732ada456cedc11ce649a99c2c26b114d52463e6114c2608c8a9eded7830a0b9b8414cbc9accec2a300b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Paul Robert Lloyd
|
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
|
+
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# jekyll-slugify_underscore
|
2
|
+
|
3
|
+
A plugin to make Jekyll slugify with underscores instead of hypens.
|
4
|
+
|
5
|
+
[](https://rubygems.org/gems/jekyll-slugify_underscore)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
1. Add `gem 'jekyll-slugify_underscore'` to your site’s Gemfile and run bundle
|
10
|
+
2. Add the following to your site’s `_config.yml`:
|
11
|
+
|
12
|
+
```yml
|
13
|
+
gems:
|
14
|
+
- jekyll-slugify_underscore
|
15
|
+
```
|
16
|
+
|
17
|
+
## Testing
|
18
|
+
|
19
|
+
1. `script/bootstrap`
|
20
|
+
2. `script/cibuild`
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork the project
|
25
|
+
2. Create a descriptively named feature branch
|
26
|
+
3. Add your feature
|
27
|
+
4. Submit a pull request
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll/slugify_underscore/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-slugify_underscore"
|
8
|
+
spec.version = Jekyll::SlugifyUnderscore::VERSION
|
9
|
+
spec.summary = "Jekyll slugify with underscores."
|
10
|
+
spec.description = "A plugin to make Jekyll slugify with underscores instead of hypens."
|
11
|
+
spec.authors = ["Paul Robert Lloyd"]
|
12
|
+
spec.email = "me+rubygems@paulrobertlloyd.com"
|
13
|
+
spec.files = Dir.glob("lib/**/*.rb")
|
14
|
+
spec.homepage = "https://github.com/paulrobertlloyd/jekyll-slugify_underscore"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "jekyll", [">= 2.0", "< 4.0"]
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
spec.add_development_dependency 'rake', '~> 0'
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
26
|
+
end
|
Binary file
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Utils
|
3
|
+
# https://github.com/jekyll/jekyll/blob/master/lib/jekyll/utils.rb
|
4
|
+
|
5
|
+
# Slugify a filename or title.
|
6
|
+
#
|
7
|
+
# string - the filename or title to slugify
|
8
|
+
# mode - how string is slugified
|
9
|
+
#
|
10
|
+
# When mode is "none", return the given string in lowercase.
|
11
|
+
#
|
12
|
+
# When mode is "raw", return the given string in lowercase,
|
13
|
+
# with every sequence of spaces characters replaced with a hyphen.
|
14
|
+
#
|
15
|
+
# When mode is "default" or nil, non-alphabetic characters are
|
16
|
+
# replaced with a hyphen too.
|
17
|
+
#
|
18
|
+
# When mode is "pretty", some non-alphabetic characters (._~!$&'()+,;=@)
|
19
|
+
# are not replaced with hyphen.
|
20
|
+
#
|
21
|
+
# Examples:
|
22
|
+
# slugify("The _config.yml file")
|
23
|
+
# # => "the-config-yml-file"
|
24
|
+
#
|
25
|
+
# slugify("The _config.yml file", "pretty")
|
26
|
+
# # => "the-_config.yml-file"
|
27
|
+
#
|
28
|
+
# Returns the slugified string.
|
29
|
+
|
30
|
+
def slugify(string, mode=nil, delimiter="_")
|
31
|
+
mode ||= 'default'
|
32
|
+
return nil if string.nil?
|
33
|
+
return string.downcase unless SLUGIFY_MODES.include?(mode)
|
34
|
+
|
35
|
+
# Replace each character sequence with a hyphen
|
36
|
+
re = case mode
|
37
|
+
when 'raw'
|
38
|
+
SLUGIFY_RAW_REGEXP
|
39
|
+
when 'default'
|
40
|
+
SLUGIFY_DEFAULT_REGEXP
|
41
|
+
when 'pretty'
|
42
|
+
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
|
43
|
+
# and is allowed in both extN and NTFS.
|
44
|
+
SLUGIFY_PRETTY_REGEXP
|
45
|
+
end
|
46
|
+
|
47
|
+
string.
|
48
|
+
# Strip according to the mode
|
49
|
+
gsub(re, delimiter).
|
50
|
+
# Remove leading/trailing hyphen
|
51
|
+
gsub(/^#{delimiter}|#{delimiter}$/i, '').
|
52
|
+
# Downcase
|
53
|
+
downcase
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
data/script/bootstrap
ADDED
data/script/cibuild
ADDED
data/script/console
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
def relative_to_root(path)
|
4
|
+
File.expand_path(path, File.dirname(File.dirname(__FILE__)))
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'jekyll'
|
8
|
+
require relative_to_root('lib/jekyll/slugify_underscore.rb')
|
9
|
+
require 'pry-debugger'
|
10
|
+
|
11
|
+
SOURCE_DIR = relative_to_root('spec/fixtures')
|
12
|
+
DEST_DIR = relative_to_root('spec/dest')
|
13
|
+
|
14
|
+
def source_dir(*files)
|
15
|
+
File.join(SOURCE_DIR, *files)
|
16
|
+
end
|
17
|
+
|
18
|
+
def dest_dir(*files)
|
19
|
+
File.join(DEST_DIR, *files)
|
20
|
+
end
|
21
|
+
|
22
|
+
def config(overrides = {})
|
23
|
+
Jekyll.configuration({
|
24
|
+
"source" => source_dir,
|
25
|
+
"destination" => dest_dir,
|
26
|
+
"url" => "http://example.org"
|
27
|
+
}).merge(overrides)
|
28
|
+
end
|
29
|
+
|
30
|
+
def site(configuration = config)
|
31
|
+
Jekyll::Site.new(configuration)
|
32
|
+
end
|
33
|
+
|
34
|
+
binding.pry
|
data/script/release
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe(Jekyll) do
|
4
|
+
let(:overrides) do
|
5
|
+
{
|
6
|
+
"source" => source_dir,
|
7
|
+
"destination" => dest_dir,
|
8
|
+
"url" => "http://example.org",
|
9
|
+
}
|
10
|
+
end
|
11
|
+
let(:config) do
|
12
|
+
Jekyll.configuration(overrides)
|
13
|
+
end
|
14
|
+
let(:site) { Jekyll::Site.new(config) }
|
15
|
+
let(:contents) { File.read(dest_dir("index.html")) }
|
16
|
+
before(:each) do
|
17
|
+
site.process
|
18
|
+
end
|
19
|
+
|
20
|
+
it "slugifies with underscores" do
|
21
|
+
expect(contents).to match /tell_me_why_i_don_t_like_hypens/
|
22
|
+
expect(contents).to_not match /tell-me-why-i-don-t-like-hypens$/
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'jekyll'
|
2
|
+
require File.expand_path('../lib/jekyll/slugify_underscore', File.dirname(__FILE__))
|
3
|
+
|
4
|
+
Jekyll.logger.log_level = :error
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.run_all_when_everything_filtered = true
|
8
|
+
config.filter_run :focus
|
9
|
+
config.order = 'random'
|
10
|
+
|
11
|
+
SOURCE_DIR = File.expand_path("../fixtures", __FILE__)
|
12
|
+
DEST_DIR = File.expand_path("../dest", __FILE__)
|
13
|
+
|
14
|
+
def source_dir(*files)
|
15
|
+
File.join(SOURCE_DIR, *files)
|
16
|
+
end
|
17
|
+
|
18
|
+
def dest_dir(*files)
|
19
|
+
File.join(DEST_DIR, *files)
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-slugify_underscore
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paul Robert Lloyd
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-12 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: '2.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rspec
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: bundler
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.6'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '1.6'
|
75
|
+
description: A plugin to make Jekyll slugify with underscores instead of hypens.
|
76
|
+
email: me+rubygems@paulrobertlloyd.com
|
77
|
+
executables: []
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files: []
|
80
|
+
files:
|
81
|
+
- ".gitignore"
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- jekyll-slugify_underscore.gemspec
|
87
|
+
- lib/jekyll/.DS_Store
|
88
|
+
- lib/jekyll/slugify_underscore.rb
|
89
|
+
- lib/jekyll/slugify_underscore/version.rb
|
90
|
+
- script/bootstrap
|
91
|
+
- script/cibuild
|
92
|
+
- script/console
|
93
|
+
- script/release
|
94
|
+
- spec/fixtures/_config.yml
|
95
|
+
- spec/fixtures/_layouts/some_default.html
|
96
|
+
- spec/fixtures/index.html
|
97
|
+
- spec/jekyll-slugify_underscore_spec.rb
|
98
|
+
- spec/spec_helper.rb
|
99
|
+
homepage: https://github.com/paulrobertlloyd/jekyll-slugify_underscore
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.4.6
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Jekyll slugify with underscores.
|
123
|
+
test_files:
|
124
|
+
- spec/fixtures/_config.yml
|
125
|
+
- spec/fixtures/_layouts/some_default.html
|
126
|
+
- spec/fixtures/index.html
|
127
|
+
- spec/jekyll-slugify_underscore_spec.rb
|
128
|
+
- spec/spec_helper.rb
|