jekyll_slugify 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 03c01f42b62607d7c4fd6e4802612c04b768ee5afc39c4012f505eacb9f6bb53
4
+ data.tar.gz: 1251294cc98c0af51887e0231b54fb0c40ea9429f36db38424e54e41ee88500f
5
+ SHA512:
6
+ metadata.gz: 1ffb6be59ca0629ab9beeae2a5abbe768129d3e2a018b92d2ad3551a9d584ef51c79d4d6c04db51ed3ae18265b1c46914dca06d07f87eebb591843eec46673d5
7
+ data.tar.gz: 07a7fdb8b209f938db0b3cde35430f851452e391989740d082d5cdf0c1b43b5af60057f05c31184d87cc86856e722bcdb454260cc958d00b4a6d4d2597a8854c
data/.gitattributes ADDED
@@ -0,0 +1,43 @@
1
+ #common settings that generally should always be used with your language specific settings
2
+
3
+ # Auto detect text files and perform LF normalization
4
+ # http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
5
+ * text=auto
6
+
7
+ #
8
+ # The above will handle all files NOT found below
9
+ #
10
+
11
+ # Documents
12
+ *.doc diff=astextplain
13
+ *.DOC diff=astextplain
14
+ *.docx diff=astextplain
15
+ *.DOCX diff=astextplain
16
+ *.dot diff=astextplain
17
+ *.DOT diff=astextplain
18
+ *.pdf diff=astextplain
19
+ *.PDF diff=astextplain
20
+ *.rtf diff=astextplain
21
+ *.RTF diff=astextplain
22
+ *.md text
23
+ *.adoc text
24
+ *.textile text
25
+ *.mustache text
26
+ *.csv text
27
+ *.tab text
28
+ *.tsv text
29
+ *.sql text
30
+
31
+ # Graphics
32
+ *.png binary
33
+ *.jpg binary
34
+ *.jpeg binary
35
+ *.gif binary
36
+ *.tif binary
37
+ *.tiff binary
38
+ *.ico binary
39
+ # SVG treated as an asset (binary) by default. If you want to treat it as text,
40
+ # comment-out the following line and uncomment the line after.
41
+ *.svg binary
42
+ #*.svg text
43
+ *.eps binary
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: 'bug'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: User Question
3
+ about: Ask us a question
4
+ title: ''
5
+ labels: 'question'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **My question:**
11
+ Briefly describe your question. What are you trying to accomplish?
12
+
13
+ **I've already tried:**
14
+ Help us help you by letting us know what you have already tried in your efforts to accomplish this.
@@ -0,0 +1,14 @@
1
+ Describe concisely the changes implemented by the code on this pull request.
2
+
3
+ - **Added:**
4
+ - Added stuff on this PR.
5
+ - **Changed:**
6
+ - Changed stuff on this PR.
7
+ - **Deprecated:**
8
+ - Deprecated stuff on this PR.
9
+ - **Removed:**
10
+ - Removed stuff on this PR.
11
+ - **Fixed:**
12
+ - Fixed stuff on this PR.
13
+ - **Security:**
14
+ - Security stuff on this PR.
@@ -0,0 +1,49 @@
1
+ ####################################################
2
+ # ToDo Bot Configuration #
3
+ ####################################################
4
+ todo:
5
+ autoAssign: true
6
+ exclude: "\.gitattributes"
7
+
8
+ ####################################################
9
+ # Welcome Bot Configuration #
10
+ ####################################################
11
+ # new-issue-welcome #
12
+ # https://github.com/behaviorbot/new-issue-welcome #
13
+ ####################################################
14
+ newIssueWelcomeComment: >
15
+ Thanks for opening your first issue here! :sparkles:
16
+
17
+ This repository has an **issue template** and we ask that you follow it.
18
+
19
+ Also, note that there is a **[Code of Conduct](CODE-OF-CONDUCT.md)**. Please take a time to read it.
20
+
21
+ The :busts_in_silhouette: humans will be here shortly to assess your issue! And thanks once again for your first issue! :tada:
22
+ ####################################################
23
+ # new-pr-welcome #
24
+ # https://github.com/behaviorbot/new-pr-welcome #
25
+ ####################################################
26
+ newPRWelcomeComment: >
27
+ Thanks for opening this pull request! :octocat:
28
+
29
+ Please check out our [Contributing Guidelines](CONTRIBUTING.md) and our [Code of Conduct](CODE-OF-CONDUCT.md).
30
+ ####################################################
31
+ # first-pr-merge #
32
+ # https://github.com/behaviorbot/first-pr-merge #
33
+ ####################################################
34
+ firstPRMergeComment: >
35
+ Congrats on merging your first pull request! :+1:
36
+
37
+ Keep on coding! :tada:
38
+
39
+ ####################################################
40
+ # Sentiment Bot Configuration #
41
+ ####################################################
42
+ # sentiment-bot #
43
+ # https://github.com/behaviorbot/sentiment-bot #
44
+ ####################################################
45
+ sentimentBotToxicityThreshold: .7
46
+ sentimentBotReplyComment: >
47
+ Please be sure to review the [code of conduct](code-of-conduct.md) and be respectful.
48
+
49
+ The human @Nereare will be here to review this shortly.
data/.gitignore ADDED
@@ -0,0 +1,147 @@
1
+ # Created by https://www.gitignore.io/api/osx,ruby,linux,macos,windows,dropbox
2
+ # Edit at https://www.gitignore.io/?templates=osx,ruby,linux,macos,windows,dropbox
3
+
4
+ ### Dropbox ###
5
+ # Dropbox settings and caches
6
+ .dropbox
7
+ .dropbox.attr
8
+ .dropbox.cache
9
+
10
+ ### Linux ###
11
+ *~
12
+
13
+ # temporary files which can be created if a process still has a handle open of a deleted file
14
+ .fuse_hidden*
15
+
16
+ # KDE directory preferences
17
+ .directory
18
+
19
+ # Linux trash folder which might appear on any partition or disk
20
+ .Trash-*
21
+
22
+ # .nfs files are created when an open file is removed but is still being accessed
23
+ .nfs*
24
+
25
+ ### macOS ###
26
+ # General
27
+ .DS_Store
28
+ .AppleDouble
29
+ .LSOverride
30
+
31
+ # Icon must end with two \r
32
+ Icon
33
+
34
+ # Thumbnails
35
+ ._*
36
+
37
+ # Files that might appear in the root of a volume
38
+ .DocumentRevisions-V100
39
+ .fseventsd
40
+ .Spotlight-V100
41
+ .TemporaryItems
42
+ .Trashes
43
+ .VolumeIcon.icns
44
+ .com.apple.timemachine.donotpresent
45
+
46
+ # Directories potentially created on remote AFP share
47
+ .AppleDB
48
+ .AppleDesktop
49
+ Network Trash Folder
50
+ Temporary Items
51
+ .apdisk
52
+
53
+ ### OSX ###
54
+ # General
55
+
56
+ # Icon must end with two \r
57
+
58
+ # Thumbnails
59
+
60
+ # Files that might appear in the root of a volume
61
+
62
+ # Directories potentially created on remote AFP share
63
+
64
+ ### Ruby ###
65
+ *.gem
66
+ *.rbc
67
+ /.config
68
+ /coverage/
69
+ /InstalledFiles
70
+ /pkg/
71
+ /spec/reports/
72
+ /spec/examples.txt
73
+ /test/tmp/
74
+ /test/version_tmp/
75
+ /tmp/
76
+
77
+ # rspec failure tracking
78
+ .rspec_status
79
+
80
+ # Used by dotenv library to load environment variables.
81
+ # .env
82
+
83
+ # Ignore Byebug command history file.
84
+ .byebug_history
85
+
86
+ ## Specific to RubyMotion:
87
+ .dat*
88
+ .repl_history
89
+ build/
90
+ *.bridgesupport
91
+ build-iPhoneOS/
92
+ build-iPhoneSimulator/
93
+
94
+ ## Specific to RubyMotion (use of CocoaPods):
95
+ #
96
+ # We recommend against adding the Pods directory to your .gitignore. However
97
+ # you should judge for yourself, the pros and cons are mentioned at:
98
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
99
+ # vendor/Pods/
100
+
101
+ ## Documentation cache and generated files:
102
+ /.yardoc/
103
+ /_yardoc/
104
+ /doc/
105
+ /rdoc/
106
+
107
+ ## Environment normalization:
108
+ /.bundle/
109
+ /vendor/bundle
110
+ /lib/bundler/man/
111
+
112
+ # for a library or gem, you might want to ignore these files since the code is
113
+ # intended to run in multiple environments; otherwise, check them in:
114
+ # Gemfile.lock
115
+ # .ruby-version
116
+ # .ruby-gemset
117
+
118
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
119
+ .rvmrc
120
+
121
+ ### Windows ###
122
+ # Windows thumbnail cache files
123
+ Thumbs.db
124
+ Thumbs.db:encryptable
125
+ ehthumbs.db
126
+ ehthumbs_vista.db
127
+
128
+ # Dump file
129
+ *.stackdump
130
+
131
+ # Folder config file
132
+ [Dd]esktop.ini
133
+
134
+ # Recycle Bin used on file shares
135
+ $RECYCLE.BIN/
136
+
137
+ # Windows Installer files
138
+ *.cab
139
+ *.msi
140
+ *.msix
141
+ *.msm
142
+ *.msp
143
+
144
+ # Windows shortcuts
145
+ *.lnk
146
+
147
+ # End of https://www.gitignore.io/api/osx,ruby,linux,macos,windows,dropbox
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
data/.travis.yml ADDED
@@ -0,0 +1,22 @@
1
+ sudo: false
2
+
3
+ language: ruby
4
+ rvm:
5
+ - 2.5.3
6
+
7
+ before_install:
8
+ - gem install bundler -v 2.0.2
9
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
10
+ - chmod +x ./cc-test-reporter
11
+ - chmod +x ./bin/console
12
+ install: bundle install --retry=3
13
+
14
+ before_script:
15
+ - ./cc-test-reporter before-build
16
+ script:
17
+ - rubocop
18
+ - bundle exec rspec spec
19
+ after_script:
20
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
21
+
22
+ cache: bundler
data/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # [jekyll_slugify](https://github.com/Nereare/jekyll_slugify) Change Log
2
+
3
+ This is the change log to jekyll_slugify. For further info on this project, see the [ReadMe file](README.md).
4
+
5
+ All notable changes to this project will be documented in this file.
6
+
7
+ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
8
+
9
+ Principles of a change log, excerpted from [Keep a Changelog](http://keepachangelog.com/):
10
+
11
+ * It’s made for humans, not machines, so legibility is crucial.
12
+ * Easy to link to any section (hence Markdown over plain text).
13
+ * One sub-section per version.
14
+ * List releases in reverse-chronological order (newest on top).
15
+ * Write all dates in `YYYY-MM-DD` format. (Example: `2012-06-02` for `June 2nd, 2012`.) It’s international, [sensible](http://xkcd.com/1179/), and language-independent.
16
+ * Explicitly mention whether the project follows [Semantic Versioning](http://semver.org/).
17
+ * Each version should:
18
+ * `List` its release date in the above format.
19
+ * `Group` changes to describe their impact on the project, as follows:
20
+ * `Added` for new features.
21
+ * `Changed` for changes in existing functionality.
22
+ * `Deprecated` for once-stable features removed in upcoming releases.
23
+ * `Removed` for deprecated features removed in this release.
24
+ * `Fixed` for any bug fixes.
25
+ * `Security` to invite users to upgrade in case of vulnerabilities.
26
+
27
+ ## [Unreleased]
28
+
29
+ ## [0.4.2] - `2019-09-07`
30
+
31
+ ### Added
32
+ * Code of Conduct from [Contributor Covenant v1.4.1](https://www.contributor-covenant.org/).
33
+ * [License](LICENSE.md).
34
+ * Git metafiles (`.gitignore` and `.gitattributes`).
35
+ * GitHub templates:
36
+ - Issues;
37
+ - Feature request;
38
+ - User question;
39
+ - Pull request.
40
+ * ReadMe file.
41
+ * Changelog file.
42
+ * Requires [I18n](https://rubygems.org/gems/i18n) gem.
43
+ * Adds main module (`JekyllSlugify`).
44
+ * Adds `#slugify` method to the native `String` class.
45
+
46
+ [Unreleased]: https://github.com/Nereare/Grimoire/compare/v0.4.2...HEAD
47
+ [0.4.2]: https://github.com/Nereare/Grimoire/releases/tag/v0.4.2
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at [igorpadoim@gmail.com](mailto:igorpadoim@gmail.com). All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,22 @@
1
+ # Contributing Guidelines
2
+
3
+ When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
4
+
5
+ Please note we have a [code of conduct](CODE-OF-CONDUCT.md), please follow it in all your interactions with the project.
6
+
7
+ ## Pull Request Checklist
8
+
9
+ Before sending your pull requests, make sure you followed this list.
10
+
11
+ 1. Read [contributing guidelines](CONTRIBUTING.md).
12
+ 2. Read [Code of Conduct](CODE-OF-CONDUCT.md).
13
+ 3. Increase the version numbers in any examples files and the [version variable on `version.rb`](lib/jekyll_slugify/version.rb) to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
14
+ 4. You may merge the Pull Request in once you have the approval of the project owner.
15
+
16
+ ## Reporting a Bug & Requesting Features
17
+
18
+ For both actions, this project uses GitHub templates, please use the adequate template when either reporting a bug or requesting a new feature.
19
+
20
+ ## Licensing and copyright
21
+
22
+ Please note that accepted contributions are included in the repository and hence added under the same [license](LICENSE.md) as the repository to which it was contributed.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in jekyll_slugify.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll_slugify (0.4.2)
5
+ i18n (~> 1.6.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ concurrent-ruby (1.1.5)
12
+ diff-lcs (1.3)
13
+ docile (1.3.2)
14
+ i18n (1.6.0)
15
+ concurrent-ruby (~> 1.0)
16
+ jaro_winkler (1.5.3)
17
+ json (2.2.0)
18
+ parallel (1.17.0)
19
+ parser (2.6.4.0)
20
+ ast (~> 2.4.0)
21
+ rainbow (3.0.0)
22
+ rake (12.3.3)
23
+ rspec (3.8.0)
24
+ rspec-core (~> 3.8.0)
25
+ rspec-expectations (~> 3.8.0)
26
+ rspec-mocks (~> 3.8.0)
27
+ rspec-core (3.8.2)
28
+ rspec-support (~> 3.8.0)
29
+ rspec-expectations (3.8.4)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.8.0)
32
+ rspec-mocks (3.8.1)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.8.0)
35
+ rspec-support (3.8.2)
36
+ rubocop (0.74.0)
37
+ jaro_winkler (~> 1.5.1)
38
+ parallel (~> 1.10)
39
+ parser (>= 2.6)
40
+ rainbow (>= 2.2.2, < 4.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (>= 1.4.0, < 1.7)
43
+ ruby-progressbar (1.10.1)
44
+ simplecov (0.17.0)
45
+ docile (~> 1.1)
46
+ json (>= 1.8, < 3)
47
+ simplecov-html (~> 0.10.0)
48
+ simplecov-html (0.10.2)
49
+ unicode-display_width (1.6.0)
50
+ yard (0.9.20)
51
+
52
+ PLATFORMS
53
+ x64-mingw32
54
+
55
+ DEPENDENCIES
56
+ bundler (~> 2.0.2)
57
+ jekyll_slugify!
58
+ rake (~> 12.3)
59
+ rspec (~> 3.8)
60
+ rubocop (~> 0.74.0)
61
+ simplecov (~> 0.17.0)
62
+ yard (~> 0.9.20)
63
+
64
+ BUNDLED WITH
65
+ 2.0.2
data/LICENSE.md ADDED
@@ -0,0 +1,24 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright © `2019` `Igor Padoim`
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the “Software”), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # jekyll_slugify
2
+
3
+ [![Gem](https://img.shields.io/gem/v/jekyll_slugify)](https://rubygems.org/gems/jekyll_slugify)
4
+ [![License](https://img.shields.io/github/license/Nereare/jekyll_slugify.svg)](https://github.com/Nereare/jekyll_slugify)
5
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE-OF-CONDUCT.md)
6
+
7
+ [![Travis (.org)](https://img.shields.io/travis/Nereare/jekyll_slugify)]()
8
+ [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/Nereare/jekyll_slugify)](https://codeclimate.com/github/Nereare/jekyll_slugify)
9
+ [![Code Climate coverage](https://img.shields.io/codeclimate/coverage/Nereare/jekyll_slugify)](https://codeclimate.com/github/Nereare/jekyll_slugify)
10
+ [![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/Nereare/jekyll_slugify)](https://libraries.io/github/Nereare/jekyll_slugify)
11
+
12
+ An extension to Ruby's `String` class that adds Jekyll-style `#slugify` method.
13
+
14
+ ## Installing
15
+
16
+ 1. Add `jekyll_slugify` to dependencies:
17
+ 1. Gemfile: `gem 'jekyll_slugify', '~> VERSION'`; or
18
+ 2. gemspec file: `spec.add_dependency 'jekyll_slugify', '~> VERSION'`;
19
+ 2. Run `bundle install` to fetch the gem from [RubyGems](https://rubygems.org/gems/jekyll_slugify);
20
+ 3. Require the gem on your code: `require 'jekyll_slugify'`
21
+ 4. Apply the `#slugify` method on a string:
22
+ ```ruby
23
+ @foo = 'Hello Worlds!'
24
+ puts @foo.slugify
25
+ => 'hello-worlds'
26
+ ```
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it!
31
+ 2. Create your feature branch: `git checkout -b my-new-feature`
32
+ 3. Commit your changes: `git commit -am 'Add some feature'`
33
+ 4. Push to the branch: `git push origin my-new-feature`
34
+ 5. Submit a pull request :tada:
35
+
36
+ Please, also read our [Contributing Guidelines](CONTRIBUTING.md).
37
+
38
+ ### Code of Conduct
39
+
40
+ Please note that this project is released with a [Contributor Code of Conduct](CODE-OF-CONDUCT.md). By participating in this project you agree to abide by its terms.
41
+
42
+ ## History & Versioning
43
+
44
+ See the [Change Log](CHANGELOG.md) for further history.
45
+
46
+ This project uses [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Nereare/jekyll_slugify/tags).
47
+
48
+ ## Legal Stuff
49
+
50
+ [![MIT License](https://i.imgur.com/Ze3dFob.png)](LICENSE.md)
51
+
52
+ This project is available under the [MIT License](https://opensource.org/licenses/MIT).
53
+
54
+ The code on this project is adapted from Jekyll's `Utils#slugify` method, available under the same [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'jekyll_slugify'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'jekyll_slugify/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'jekyll_slugify'
9
+ spec.version = JekyllSlugify.version
10
+ spec.authors = ['Igor Padoim']
11
+ spec.email = ['igorpadoim@gmail.com']
12
+ spec.license = 'MIT'
13
+
14
+ spec.summary = 'An extension to Ruby\'s `String` class that adds '\
15
+ 'Jekyll-style `#slugify` method.'
16
+ spec.description = spec.summary
17
+ spec.homepage = 'https://github.com/Nereare/jekyll_slugify'
18
+
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = spec.homepage
21
+ spec.metadata['changelog_uri'] = spec.homepage + '/blob/master/CHANGELOG.md'
22
+
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ f.match(%r{^(test|spec|features)/})
26
+ end
27
+ end
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.required_ruby_version = '>= 2.5.0'
33
+
34
+ spec.add_development_dependency 'bundler', '~> 2.0.2'
35
+ spec.add_development_dependency 'rake', '~> 12.3'
36
+ spec.add_development_dependency 'rspec', '~> 3.8'
37
+ spec.add_development_dependency 'rubocop', '~> 0.74.0'
38
+ spec.add_development_dependency 'simplecov', '~> 0.17.0'
39
+ spec.add_development_dependency 'yard', '~> 0.9.20'
40
+
41
+ spec.add_dependency 'i18n', '~> 1.6.0'
42
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # An extension to Ruby's String class that adds Jekyll-style `slugify` method.
4
+ module JekyllSlugify
5
+ # Sets the current version of the gem
6
+ @version = '0.4.2'
7
+
8
+ # Returns the Gem's current version.
9
+ #
10
+ # @return [String] The Gem's current version.
11
+ def self.version
12
+ @version
13
+ end
14
+ end
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll_slugify/version'
4
+ require 'i18n'
5
+ require 'string'
6
+
7
+ # An extension to Ruby's String class that adds Jekyll-style `slugify` method.
8
+ module JekyllSlugify
9
+ # Sets the method to be applied on {String#slugify}.
10
+ class Slugify
11
+ # Constants for use in {#initialize}'s mode parameter.
12
+ SLUGIFY_MODES = %w[raw default pretty ascii latin].freeze
13
+ # The _raw_ mode of slugifying a string.
14
+ SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
15
+ # The _default_ mode of slugifying a string.
16
+ SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
17
+ # The _pretty_ mode of slugifying a string.
18
+ SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
19
+ # The _ascii_ mode of slugifying a string.
20
+ SLUGIFY_ASCII_REGEXP = Regexp.new('[^[A-Za-z0-9]]+').freeze
21
+
22
+ # The slugified string
23
+ attr_reader :slug
24
+
25
+ # Slugify a filename or title.
26
+ #
27
+ # string - the filename or title to slugify
28
+ # mode - how string is slugified
29
+ # cased - whether to replace all uppercase letters with their
30
+ # lowercase counterparts
31
+ #
32
+ # When mode is "none", return the given string.
33
+ #
34
+ # When mode is "raw", return the given string,
35
+ # with every sequence of spaces characters replaced with a hyphen.
36
+ #
37
+ # When mode is "default" or nil, non-alphabetic characters are
38
+ # replaced with a hyphen too.
39
+ #
40
+ # When mode is "pretty", some non-alphabetic characters (._~!$&'()+,;=@)
41
+ # are not replaced with hyphen.
42
+ #
43
+ # When mode is "ascii", some everything else except ASCII characters
44
+ # a-z (lowercase), A-Z (uppercase) and 0-9 (numbers) are not replaced with
45
+ # hyphen.
46
+ #
47
+ # When mode is "latin", the input string is first preprocessed so that
48
+ # any letters with accents are replaced with the plain letter. Afterwards,
49
+ # it follows the "default" mode of operation.
50
+ #
51
+ # If cased is true, all uppercase letters in the result string are
52
+ # replaced with their lowercase counterparts.
53
+ #
54
+ # Examples:
55
+ # slugify("The _config.yml file")
56
+ # # => "the-config-yml-file"
57
+ #
58
+ # slugify("The _config.yml file", "pretty")
59
+ # # => "the-_config.yml-file"
60
+ #
61
+ # slugify("The _config.yml file", "pretty", true)
62
+ # # => "The-_config.yml file"
63
+ #
64
+ # slugify("The _config.yml file", "ascii")
65
+ # # => "the-config-yml-file"
66
+ #
67
+ # slugify("The _config.yml file", "latin")
68
+ # # => "the-config-yml-file"
69
+ #
70
+ # Returns the slugified string.
71
+ def initialize(string, mode: nil, cased: false)
72
+ string, mode = check_params(string, mode, cased)
73
+
74
+ string = deal_with_locales(mode, string)
75
+ @slug = replace_character_sequence_with_hyphen(string, mode: mode)
76
+ @slug = process_slug(@slug, cased)
77
+ slug_empty?(@slug)
78
+ end
79
+
80
+ # Returns the slugified string.
81
+ #
82
+ # @return [String] The slugified string.
83
+ def to_s
84
+ @slug
85
+ end
86
+
87
+ private
88
+
89
+ def check_params(string, mode, cased)
90
+ mode ||= 'default'
91
+ msg = 'String must be a non-nil String'
92
+ raise ArgumentError, msg if string.nil?
93
+ raise ArgumentError, msg unless string.is_a? String
94
+
95
+ mode = 'latin' unless SLUGIFY_MODES.include?(mode)
96
+ string = cased ? string : string.downcase
97
+
98
+ [string, mode]
99
+ end
100
+
101
+ def process_slug(slug, cased)
102
+ # Remove leading/trailing hyphen
103
+ slug.gsub!(/^\-|\-$/i, '')
104
+ slug.downcase! unless cased
105
+
106
+ slug
107
+ end
108
+
109
+ def slug_empty?(slug)
110
+ msg = 'Empty `slug` generated for given String'
111
+ raise msg if slug.empty?
112
+ end
113
+
114
+ def deal_with_locales(mode, string)
115
+ # Drop accent marks from latin characters. Everything else turns to ?
116
+ if mode == 'latin'
117
+ if I18n.config.available_locales.empty?
118
+ I18n.config.available_locales = :en
119
+ end
120
+ string = I18n.transliterate(string)
121
+ end
122
+ string
123
+ end
124
+
125
+ def replace_character_sequence_with_hyphen(string, mode: 'default')
126
+ replaceable_char = replace_character(mode)
127
+ string.gsub(replaceable_char, '-')
128
+ end
129
+
130
+ def replace_character(mode)
131
+ case mode
132
+ when 'raw'
133
+ SLUGIFY_RAW_REGEXP
134
+ when 'pretty'
135
+ SLUGIFY_PRETTY_REGEXP
136
+ when 'ascii'
137
+ SLUGIFY_ASCII_REGEXP
138
+ else
139
+ SLUGIFY_DEFAULT_REGEXP
140
+ end
141
+ end
142
+ end
143
+ end
data/lib/string.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll_slugify'
4
+
5
+ # Extends the native String class to have a {#slugify} method.
6
+ class String
7
+ # Slugifies a string.
8
+ #
9
+ # @param mode [String or nil] Either one of _raw_, _default_, _pretty_,
10
+ # _ascii_, _latin_ or nil.
11
+ # @param cased [Boolean] If the slugify method must respect original case.
12
+ # @return [String] The slugified string.
13
+ def slugify(mode = 'latin', cased = nil)
14
+ JekyllSlugify::Slugify.new(self, mode: mode, cased: cased).to_s
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll_slugify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.2
5
+ platform: ruby
6
+ authors:
7
+ - Igor Padoim
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-09-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.74.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.74.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.17.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.17.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.20
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.9.20
97
+ - !ruby/object:Gem::Dependency
98
+ name: i18n
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.6.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.6.0
111
+ description: An extension to Ruby's `String` class that adds Jekyll-style `#slugify`
112
+ method.
113
+ email:
114
+ - igorpadoim@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitattributes"
120
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
121
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
122
+ - ".github/ISSUE_TEMPLATE/user_question.md"
123
+ - ".github/PULL_REQUEST_TEMPLATE.md"
124
+ - ".github/config.yml"
125
+ - ".gitignore"
126
+ - ".rspec"
127
+ - ".rubocop.yml"
128
+ - ".travis.yml"
129
+ - CHANGELOG.md
130
+ - CODE-OF-CONDUCT.md
131
+ - CONTRIBUTING.md
132
+ - Gemfile
133
+ - Gemfile.lock
134
+ - LICENSE.md
135
+ - README.md
136
+ - Rakefile
137
+ - bin/console
138
+ - bin/setup
139
+ - jekyll_slugify.gemspec
140
+ - lib/jekyll_slugify.rb
141
+ - lib/jekyll_slugify/version.rb
142
+ - lib/string.rb
143
+ homepage: https://github.com/Nereare/jekyll_slugify
144
+ licenses:
145
+ - MIT
146
+ metadata:
147
+ homepage_uri: https://github.com/Nereare/jekyll_slugify
148
+ source_code_uri: https://github.com/Nereare/jekyll_slugify
149
+ changelog_uri: https://github.com/Nereare/jekyll_slugify/blob/master/CHANGELOG.md
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: 2.5.0
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ requirements: []
165
+ rubygems_version: 3.0.6
166
+ signing_key:
167
+ specification_version: 4
168
+ summary: An extension to Ruby's `String` class that adds Jekyll-style `#slugify` method.
169
+ test_files: []