jekyll-typogrify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/jekyll-typogrify.gemspec +26 -0
- data/lib/jekyll/typogrify/version.rb +5 -0
- data/lib/jekyll/typogrify.rb +78 -0
- data/lib/jekyll-typogrify.rb +2 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 01ba816f9c2f68573bf7caad21c696065c9cd8b2
|
4
|
+
data.tar.gz: 20a8b73ccde4955f4d78519f831187c4ab39b9c5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f0c3dbd1f5299c61a9860ad334dd903e421a0fddf094d838a3f933b632b14dd873f5736750f3081e1a28d27abf2133288c9459f7ba866ab815ea9118708604c4
|
7
|
+
data.tar.gz: fead87e4e8ac4a8542b0f98fba62f35780c4980ff7039ea5dc5757a49cbc2cdbe926c4e46505e6c30f69b269668de9f5d8a6c3d8e019d7ce34088c6d34a3e65b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Myles Braithwaite
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Jekyll::Typogrify
|
2
|
+
|
3
|
+
Improves typography on your Jekyll site using [typogruby](http://avdgaag.github.io/typogruby/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'jekyll-typogrify'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install jekyll-typogrify
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Widont
|
24
|
+
|
25
|
+
Replaces space(s) before the last word (or tag before the last word) before an optional closing element (a, em, span, strong) before a closing tag (p, h[1-6], li, dt, dd) or the end of the string.
|
26
|
+
|
27
|
+
```html
|
28
|
+
<h1>{{ page.title | widont }}</h1>
|
29
|
+
```
|
30
|
+
|
31
|
+
## Development
|
32
|
+
|
33
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
34
|
+
|
35
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/myles/jekyll-typogrify/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "jekyll/typogrify"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
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/typogrify/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-typogrify"
|
8
|
+
spec.version = Jekyll::Typogrify::VERSION
|
9
|
+
spec.authors = ["Myles Braithwaite"]
|
10
|
+
spec.email = ["me@mylesbraithwaite.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A Jekyll tyopgraphy plugin.}
|
13
|
+
spec.description = %q{A Jekyll plugin that bring the fuctions of typogruby.}
|
14
|
+
spec.homepage = "https://github.com/myles/jekyll-typogrify"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "jekyll"
|
26
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require "jekyll/typogrify/version"
|
2
|
+
|
3
|
+
require 'typogruby'
|
4
|
+
require 'liquid'
|
5
|
+
|
6
|
+
module Jekyll
|
7
|
+
module TypogrifyFilter
|
8
|
+
# converts a & surrounded by optional whitespace or a non-breaking space
|
9
|
+
# to the HTML entity and surrounds it in a span with a styled class.
|
10
|
+
#
|
11
|
+
# @param [String] text input text
|
12
|
+
# @return [String] input text with ampersands wrapped
|
13
|
+
def amp(text)
|
14
|
+
return Typogruby.amp(text)
|
15
|
+
end
|
16
|
+
|
17
|
+
# surrounds two or more consecutive captial letters, perhaps with
|
18
|
+
# interspersed digits and periods in a span with a styled class.
|
19
|
+
#
|
20
|
+
# @param [String] text input text
|
21
|
+
# @return [String] input text with caps wrapped
|
22
|
+
def caps(text)
|
23
|
+
return Typogruby.caps(text)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Converts special characters (excluding HTML tags) to HTML entities.
|
27
|
+
#
|
28
|
+
# @param [String] text input text
|
29
|
+
# @return [String] input text with all special characters converted to
|
30
|
+
# HTML entities.
|
31
|
+
def entities(text)
|
32
|
+
return Typogruby.entities(text)
|
33
|
+
end
|
34
|
+
|
35
|
+
# main function to do all the functions from the method.
|
36
|
+
#
|
37
|
+
# @param [String] text input text
|
38
|
+
# @return [String] input text with all filters applied
|
39
|
+
def improve(text)
|
40
|
+
return Typogruby.improve(text)
|
41
|
+
end
|
42
|
+
|
43
|
+
# encloses initial single or double quote, or their entities
|
44
|
+
# (optionally preceeded by a block element and perhaps an inline element)
|
45
|
+
# with a span that can be styled.
|
46
|
+
#
|
47
|
+
# @param [String] text input text
|
48
|
+
# @return [String] input text with initial quotes wrapped
|
49
|
+
|
50
|
+
def initial_quotes(text)
|
51
|
+
return Typogruby.initial_quotes(text)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Applies smartypants to a given piece of text
|
55
|
+
#
|
56
|
+
# @see https://rubygems.org/gems/rubypants
|
57
|
+
# @param [String] text input text
|
58
|
+
# @return [String] input text with smartypants applied
|
59
|
+
def smartypants(text)
|
60
|
+
return Typogruby.smartypants(text)
|
61
|
+
end
|
62
|
+
|
63
|
+
# replaces space(s) before the last word (or tag before the last word)
|
64
|
+
# before an optional closing element (<tt>a</tt>, <tt>em</tt>,
|
65
|
+
# <tt>span</tt>, strong) before a closing tag (<tt>p</tt>, <tt>h[1-6]</tt>,
|
66
|
+
# <tt>li</tt>, <tt>dt</tt>, <tt>dd</tt>) or the end of the string.
|
67
|
+
#
|
68
|
+
# @see http://mucur.name/posts/widon-t-and-smartypants-helpers-for-rails
|
69
|
+
# @see http://shauninman.com/archive/2006/08/22/widont_wordpress_plugin
|
70
|
+
# @param [String] text input text
|
71
|
+
# @return [String] input text with non-breaking spaces inserted
|
72
|
+
def widont(text)
|
73
|
+
return Typogruby.widont(text)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
Liquid::Template.register_filter(Jekyll::TypogrifyFilter)
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-typogrify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Myles Braithwaite
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-11 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: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jekyll
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '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'
|
69
|
+
description: A Jekyll plugin that bring the fuctions of typogruby.
|
70
|
+
email:
|
71
|
+
- me@mylesbraithwaite.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .rspec
|
78
|
+
- .travis.yml
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- jekyll-typogrify.gemspec
|
87
|
+
- lib/jekyll-typogrify.rb
|
88
|
+
- lib/jekyll/typogrify.rb
|
89
|
+
- lib/jekyll/typogrify/version.rb
|
90
|
+
homepage: https://github.com/myles/jekyll-typogrify
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.4.6
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: A Jekyll tyopgraphy plugin.
|
114
|
+
test_files: []
|