jekyll-typogrify 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +56 -39
- data/README.md +14 -3
- data/appveyor.yml +1 -1
- data/jekyll-typogrify.gemspec +2 -2
- data/lib/jekyll/typogrify.rb +51 -10
- data/lib/jekyll/typogrify/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adc86d464ffe5ba4aa8e6488b75dd88a40eb1a6b
|
4
|
+
data.tar.gz: 92567898604f6bef389a3df613966f88353f39d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a2b56115bebc4c8fdb271d6f0ef6c4cb6c8349fbe58f538dbd09efd3fa9b7ae146ec9895da681cf11555f457aebee163c50b2f49292b047f73b2e0b943ed787
|
7
|
+
data.tar.gz: 24bb2593043c63c5de622eb52ec0d161f365446da3cd21e802bbd884e6ca5742491b2edc70b2f05087a3ae2710c92193745230380f6e58171fbc06bed70fe9cf
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,72 +1,89 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-typogrify (0.3.
|
4
|
+
jekyll-typogrify (0.3.3)
|
5
5
|
titlecase
|
6
6
|
typogruby
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.5.
|
12
|
-
public_suffix (
|
13
|
-
codeclimate-test-reporter (1.0.
|
11
|
+
addressable (2.5.2)
|
12
|
+
public_suffix (>= 2.0.2, < 4.0)
|
13
|
+
codeclimate-test-reporter (1.0.8)
|
14
|
+
simplecov (<= 0.13)
|
14
15
|
colorator (1.1.0)
|
15
|
-
|
16
|
+
concurrent-ruby (1.0.5)
|
17
|
+
diff-lcs (1.3)
|
16
18
|
docile (1.1.5)
|
17
|
-
|
19
|
+
em-websocket (0.5.1)
|
20
|
+
eventmachine (>= 0.12.9)
|
21
|
+
http_parser.rb (~> 0.6.0)
|
22
|
+
eventmachine (1.2.5)
|
23
|
+
ffi (1.9.18)
|
18
24
|
forwardable-extended (2.6.0)
|
19
|
-
|
25
|
+
http_parser.rb (0.6.0)
|
26
|
+
i18n (0.9.1)
|
27
|
+
concurrent-ruby (~> 1.0)
|
28
|
+
jekyll (3.7.0)
|
20
29
|
addressable (~> 2.4)
|
21
30
|
colorator (~> 1.0)
|
31
|
+
em-websocket (~> 0.5)
|
32
|
+
i18n (~> 0.7)
|
22
33
|
jekyll-sass-converter (~> 1.0)
|
23
|
-
jekyll-watch (~>
|
24
|
-
kramdown (~> 1.
|
25
|
-
liquid (~>
|
34
|
+
jekyll-watch (~> 2.0)
|
35
|
+
kramdown (~> 1.14)
|
36
|
+
liquid (~> 4.0)
|
26
37
|
mercenary (~> 0.3.3)
|
27
38
|
pathutil (~> 0.9)
|
28
|
-
rouge (
|
39
|
+
rouge (>= 1.7, < 4)
|
29
40
|
safe_yaml (~> 1.0)
|
30
|
-
jekyll-sass-converter (1.
|
41
|
+
jekyll-sass-converter (1.5.1)
|
31
42
|
sass (~> 3.4)
|
32
|
-
jekyll-watch (
|
33
|
-
listen (~> 3.0
|
34
|
-
json (2.0
|
35
|
-
kramdown (1.
|
36
|
-
liquid (
|
37
|
-
listen (3.
|
43
|
+
jekyll-watch (2.0.0)
|
44
|
+
listen (~> 3.0)
|
45
|
+
json (2.1.0)
|
46
|
+
kramdown (1.16.2)
|
47
|
+
liquid (4.0.0)
|
48
|
+
listen (3.1.5)
|
38
49
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
39
50
|
rb-inotify (~> 0.9, >= 0.9.7)
|
51
|
+
ruby_dep (~> 1.2)
|
40
52
|
mercenary (0.3.6)
|
41
|
-
pathutil (0.
|
53
|
+
pathutil (0.16.1)
|
42
54
|
forwardable-extended (~> 2.6)
|
43
|
-
public_suffix (
|
55
|
+
public_suffix (3.0.1)
|
44
56
|
rake (10.5.0)
|
45
|
-
rb-fsevent (0.
|
46
|
-
rb-inotify (0.9.
|
47
|
-
ffi (>= 0.5.0)
|
48
|
-
rouge (1.
|
49
|
-
rspec (3.
|
50
|
-
rspec-core (~> 3.
|
51
|
-
rspec-expectations (~> 3.
|
52
|
-
rspec-mocks (~> 3.
|
53
|
-
rspec-core (3.
|
54
|
-
rspec-support (~> 3.
|
55
|
-
rspec-expectations (3.
|
57
|
+
rb-fsevent (0.10.2)
|
58
|
+
rb-inotify (0.9.10)
|
59
|
+
ffi (>= 0.5.0, < 2)
|
60
|
+
rouge (3.1.0)
|
61
|
+
rspec (3.7.0)
|
62
|
+
rspec-core (~> 3.7.0)
|
63
|
+
rspec-expectations (~> 3.7.0)
|
64
|
+
rspec-mocks (~> 3.7.0)
|
65
|
+
rspec-core (3.7.1)
|
66
|
+
rspec-support (~> 3.7.0)
|
67
|
+
rspec-expectations (3.7.0)
|
56
68
|
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
-
rspec-support (~> 3.
|
58
|
-
rspec-mocks (3.
|
69
|
+
rspec-support (~> 3.7.0)
|
70
|
+
rspec-mocks (3.7.0)
|
59
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
-
rspec-support (~> 3.
|
61
|
-
rspec-support (3.
|
72
|
+
rspec-support (~> 3.7.0)
|
73
|
+
rspec-support (3.7.0)
|
74
|
+
ruby_dep (1.5.0)
|
62
75
|
rubypants (0.6.0)
|
63
76
|
safe_yaml (1.0.4)
|
64
|
-
sass (3.
|
65
|
-
|
77
|
+
sass (3.5.5)
|
78
|
+
sass-listen (~> 4.0.0)
|
79
|
+
sass-listen (4.0.0)
|
80
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
81
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
82
|
+
simplecov (0.13.0)
|
66
83
|
docile (~> 1.1.0)
|
67
84
|
json (>= 1.8, < 3)
|
68
85
|
simplecov-html (~> 0.10.0)
|
69
|
-
simplecov-html (0.10.
|
86
|
+
simplecov-html (0.10.2)
|
70
87
|
titlecase (0.1.1)
|
71
88
|
typogruby (1.0.18)
|
72
89
|
rubypants
|
@@ -86,4 +103,4 @@ DEPENDENCIES
|
|
86
103
|
typogruby
|
87
104
|
|
88
105
|
BUNDLED WITH
|
89
|
-
1.
|
106
|
+
1.16.0
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/myles/jekyll-typogrify.svg?branch=
|
2
|
-
[![Build Status](https://ci.appveyor.com/api/projects/status/bw6g4akc9x8g1x33/branch/master?svg=true)](https://ci.appveyor.com/project/MylesBraithwaite/jekyll-typogrify/branch/
|
1
|
+
[![Build Status](https://travis-ci.org/myles/jekyll-typogrify.svg?branch=develop)](https://travis-ci.org/myles/jekyll-typogrify)
|
2
|
+
[![Build Status](https://ci.appveyor.com/api/projects/status/bw6g4akc9x8g1x33/branch/master?svg=true)](https://ci.appveyor.com/project/MylesBraithwaite/jekyll-typogrify/branch/develop)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/jekyll-typogrify.svg)](http://badge.fury.io/rb/jekyll-typogrify)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/myles/jekyll-typogrify/badges/gpa.svg)](https://codeclimate.com/github/myles/jekyll-typogrify)
|
5
5
|
[![Test Coverage](https://codeclimate.com/github/myles/jekyll-typogrify/badges/coverage.svg)](https://codeclimate.com/github/myles/jekyll-typogrify/coverage)
|
6
6
|
|
7
7
|
# Jekyll::Typogrify
|
8
8
|
|
9
|
-
Improves typography on your Jekyll site using [typogruby](http://avdgaag.github.io/typogruby/)
|
9
|
+
Improves typography on your Jekyll site using [typogruby](http://avdgaag.github.io/typogruby/), [titlecase](https://github.com/samsouder/titlecase), and some other useful functions.
|
10
10
|
|
11
11
|
| Before | After |
|
12
12
|
| ------ | ----- |
|
@@ -57,6 +57,17 @@ Surrounds two or more consecutive capital letters, perhaps with interspersed dig
|
|
57
57
|
<h1><span class="caps">A.B.C.</span> Corp.</h1>
|
58
58
|
```
|
59
59
|
|
60
|
+
#### Custom Capitalisation
|
61
|
+
|
62
|
+
Typogruby `cap` module doesn't support having hyphens so there is a custom
|
63
|
+
module:
|
64
|
+
|
65
|
+
```html
|
66
|
+
<h1>{{ "North American P-51 Mustang" | jt_caps }}</h1>
|
67
|
+
|
68
|
+
<h1>North American <span class="caps">P-51</span> Mustang</h1>
|
69
|
+
```
|
70
|
+
|
60
71
|
### Entities
|
61
72
|
|
62
73
|
Converts special characters (excluding HTML tags) to HTML entities.
|
data/appveyor.yml
CHANGED
data/jekyll-typogrify.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'jekyll/typogrify/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "jekyll-typogrify"
|
8
8
|
spec.version = Jekyll::Typogrify::VERSION
|
9
|
-
spec.summary = %q{A Jekyll plugin that
|
10
|
-
spec.description = %q{A Jekyll plugin that
|
9
|
+
spec.summary = %q{A Jekyll plugin that improves the typography of your Liquid templates.}
|
10
|
+
spec.description = %q{A Jekyll plugin that improves the typography of your Liquid templates.}
|
11
11
|
spec.license = "MIT"
|
12
12
|
|
13
13
|
spec.authors = ["Myles Braithwaite"]
|
data/lib/jekyll/typogrify.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "jekyll/typogrify/version"
|
2
2
|
|
3
|
+
require 'rubypants'
|
3
4
|
require 'typogruby'
|
4
5
|
require 'titlecase'
|
5
6
|
require 'liquid'
|
@@ -14,7 +15,7 @@ module Jekyll
|
|
14
15
|
def amp(text)
|
15
16
|
return Typogruby.amp(text.to_s)
|
16
17
|
end
|
17
|
-
|
18
|
+
|
18
19
|
# surrounds two or more consecutive capital letters, perhaps with
|
19
20
|
# interspersed digits and periods in a span with a styled class.
|
20
21
|
#
|
@@ -23,7 +24,7 @@ module Jekyll
|
|
23
24
|
def caps(text)
|
24
25
|
return Typogruby.caps(text.to_s)
|
25
26
|
end
|
26
|
-
|
27
|
+
|
27
28
|
# Converts special characters (excluding HTML tags) to HTML entities.
|
28
29
|
#
|
29
30
|
# @param [String] text input text
|
@@ -32,7 +33,7 @@ module Jekyll
|
|
32
33
|
def entities(text)
|
33
34
|
return Typogruby.entities(text.to_s)
|
34
35
|
end
|
35
|
-
|
36
|
+
|
36
37
|
# main function to do all the functions from the method.
|
37
38
|
#
|
38
39
|
# @param [String] text input text
|
@@ -40,27 +41,27 @@ module Jekyll
|
|
40
41
|
def improve(text)
|
41
42
|
return Typogruby.improve(text.to_s)
|
42
43
|
end
|
43
|
-
|
44
|
+
|
44
45
|
# encloses initial single or double quote, or their entities
|
45
46
|
# (optionally preceeded by a block element and perhaps an inline element)
|
46
47
|
# with a span that can be styled.
|
47
48
|
#
|
48
49
|
# @param [String] text input text
|
49
50
|
# @return [String] input text with initial quotes wrapped
|
50
|
-
|
51
|
+
|
51
52
|
def initial_quotes(text)
|
52
53
|
return Typogruby.initial_quotes(text.to_s)
|
53
54
|
end
|
54
|
-
|
55
|
+
|
55
56
|
# Applies smartypants to a given piece of text
|
56
|
-
#
|
57
|
+
#
|
57
58
|
# @see https://rubygems.org/gems/rubypants
|
58
59
|
# @param [String] text input text
|
59
60
|
# @return [String] input text with smartypants applied
|
60
61
|
def smartypants(text)
|
61
62
|
return Typogruby.smartypants(text.to_s)
|
62
63
|
end
|
63
|
-
|
64
|
+
|
64
65
|
# replaces space(s) before the last word (or tag before the last word)
|
65
66
|
# before an optional closing element (<tt>a</tt>, <tt>em</tt>,
|
66
67
|
# <tt>span</tt>, strong) before a closing tag (<tt>p</tt>, <tt>h[1-6]</tt>,
|
@@ -73,7 +74,7 @@ module Jekyll
|
|
73
74
|
def widont(text)
|
74
75
|
return Typogruby.widont(text.to_s)
|
75
76
|
end
|
76
|
-
|
77
|
+
|
77
78
|
# convert a given piece of text to titlecase
|
78
79
|
#
|
79
80
|
# @param [String] text input text
|
@@ -81,7 +82,7 @@ module Jekyll
|
|
81
82
|
def titlecase(text)
|
82
83
|
return text.to_s.titlecase
|
83
84
|
end
|
84
|
-
|
85
|
+
|
85
86
|
# wraps words in a span class that can look like something else
|
86
87
|
#
|
87
88
|
# @param [String] text input text
|
@@ -92,6 +93,46 @@ module Jekyll
|
|
92
93
|
"#{before}<span class=\"fix-letter-spacing\">#{str}</span>"
|
93
94
|
}
|
94
95
|
end
|
96
|
+
|
97
|
+
# surrounds two or more consecutive capital letters, perhaps with
|
98
|
+
# interspersed digits and periods in a span with a styled class.
|
99
|
+
#
|
100
|
+
# @param [String] text input text
|
101
|
+
# @return [String] input text with caps wrapped
|
102
|
+
def jt_caps(text)
|
103
|
+
return custom_caps(text.to_s)
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
# custom modules to jekyll-typogrify
|
109
|
+
|
110
|
+
# surrounds two or more consecutive capital letters, perhaps with
|
111
|
+
# interspersed digits and periods in a span with a styled class.
|
112
|
+
#
|
113
|
+
# @param [String] text input text
|
114
|
+
# @return [String] input text with caps wrapped
|
115
|
+
def custom_caps(text)
|
116
|
+
# $1 and $2 are excluded HTML tags, $3 is the part before the caps and $4 is the caps match
|
117
|
+
text.gsub(%r{
|
118
|
+
(<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values
|
119
|
+
(\s| |^|'|"|>|) # Make sure our capture is preceded by whitespace or quotes
|
120
|
+
([A-Z\d](?:(\.|'|-|&|&|&\#38;)?[A-Z\d][\.']?){1,}) # Capture capital words, with optional dots, numbers or ampersands in between
|
121
|
+
(?!\w) # ...which must not be followed by a word character.
|
122
|
+
}x) do |str|
|
123
|
+
tag, before, caps = $1, $2, $3
|
124
|
+
|
125
|
+
# Do nothing with the contents if ignored tags, the inside of an opening HTML element
|
126
|
+
# so we don't mess up attribute values, or if our capture is only digits.
|
127
|
+
if tag || caps =~ /^\d+\.?$/
|
128
|
+
str
|
129
|
+
elsif $3 =~ /^[\d\.]+$/
|
130
|
+
before + caps
|
131
|
+
else
|
132
|
+
before + '<span class="caps">' + caps + '</span>'
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
95
136
|
end
|
96
137
|
end
|
97
138
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-typogrify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myles Braithwaite
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typogruby
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: A Jekyll plugin that
|
97
|
+
description: A Jekyll plugin that improves the typography of your Liquid templates.
|
98
98
|
email:
|
99
99
|
- me@mylesbraithwaite.com
|
100
100
|
executables: []
|
@@ -144,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.6.13
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
|
-
summary: A Jekyll plugin that
|
150
|
+
summary: A Jekyll plugin that improves the typography of your Liquid templates.
|
151
151
|
test_files: []
|