jekyll-typogrify 0.3.2 → 0.3.3

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: ce31a9b1d9e6acc63c62db986e074ca115af2dfd
4
- data.tar.gz: b5cdc776bd5c20fa8a3e600f7a615c97f5aaf1c5
3
+ metadata.gz: adc86d464ffe5ba4aa8e6488b75dd88a40eb1a6b
4
+ data.tar.gz: 92567898604f6bef389a3df613966f88353f39d6
5
5
  SHA512:
6
- metadata.gz: f3d7416811a35901877ade9b523202488c83cc8fd2178139187bcdd23883d13352c5c0a62d6c9a3050b121eeeb002a8828e7b9d51b43876acf803b0aff8da66b
7
- data.tar.gz: 54c784d7fd842b457415b85df084367ac97d2231355a754258432a52c96a0e0e041384bde0ef8b14112b5d18466bc2adeeecd3202f31897078ce8c4ab44841a8
6
+ metadata.gz: 6a2b56115bebc4c8fdb271d6f0ef6c4cb6c8349fbe58f538dbd09efd3fa9b7ae146ec9895da681cf11555f457aebee163c50b2f49292b047f73b2e0b943ed787
7
+ data.tar.gz: 24bb2593043c63c5de622eb52ec0d161f365446da3cd21e802bbd884e6ca5742491b2edc70b2f05087a3ae2710c92193745230380f6e58171fbc06bed70fe9cf
data/.travis.yml CHANGED
@@ -12,4 +12,4 @@ after_script:
12
12
  after_success:
13
13
  - gem install package_cloud
14
14
  - bundle exec rake build
15
- - package_cloud push myles/jekyll-typogrify pkg/jekyll-typogrify-0.3.2.gem
15
+ - package_cloud push myles/jekyll-typogrify pkg/jekyll-typogrify-0.3.3.gem
data/Gemfile.lock CHANGED
@@ -1,72 +1,89 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-typogrify (0.3.2)
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.0)
12
- public_suffix (~> 2.0, >= 2.0.2)
13
- codeclimate-test-reporter (1.0.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
- diff-lcs (1.2.5)
16
+ concurrent-ruby (1.0.5)
17
+ diff-lcs (1.3)
16
18
  docile (1.1.5)
17
- ffi (1.9.14)
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
- jekyll (3.3.0)
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 (~> 1.1)
24
- kramdown (~> 1.3)
25
- liquid (~> 3.0)
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 (~> 1.7)
39
+ rouge (>= 1.7, < 4)
29
40
  safe_yaml (~> 1.0)
30
- jekyll-sass-converter (1.4.0)
41
+ jekyll-sass-converter (1.5.1)
31
42
  sass (~> 3.4)
32
- jekyll-watch (1.5.0)
33
- listen (~> 3.0, < 3.1)
34
- json (2.0.2)
35
- kramdown (1.12.0)
36
- liquid (3.0.6)
37
- listen (3.0.8)
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.14.0)
53
+ pathutil (0.16.1)
42
54
  forwardable-extended (~> 2.6)
43
- public_suffix (2.0.3)
55
+ public_suffix (3.0.1)
44
56
  rake (10.5.0)
45
- rb-fsevent (0.9.8)
46
- rb-inotify (0.9.7)
47
- ffi (>= 0.5.0)
48
- rouge (1.11.1)
49
- rspec (3.5.0)
50
- rspec-core (~> 3.5.0)
51
- rspec-expectations (~> 3.5.0)
52
- rspec-mocks (~> 3.5.0)
53
- rspec-core (3.5.4)
54
- rspec-support (~> 3.5.0)
55
- rspec-expectations (3.5.0)
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.5.0)
58
- rspec-mocks (3.5.0)
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.5.0)
61
- rspec-support (3.5.0)
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.4.22)
65
- simplecov (0.12.0)
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.0)
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.12.5
106
+ 1.16.0
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
- [![Build Status](https://travis-ci.org/myles/jekyll-typogrify.svg?branch=v0.3.1)](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/v0.3.1)
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/) and [titlecase](https://github.com/samsouder/titlecase).
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
@@ -1,4 +1,4 @@
1
- version: v0.3.2-{build}-{branch}
1
+ version: v0.3.3-{branch}-{build}
2
2
 
3
3
  environment:
4
4
  matrix:
@@ -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 bring the functions of typogruby.}
10
- spec.description = %q{A Jekyll plugin that bring the functions of typogruby.}
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"]
@@ -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|&nbsp;|^|'|"|>|) # Make sure our capture is preceded by whitespace or quotes
120
+ ([A-Z\d](?:(\.|'|-|&|&amp;|&\#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
 
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Typogrify
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
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.2
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: 2016-11-06 00:00:00.000000000 Z
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 bring the functions of typogruby.
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.4.5.1
147
+ rubygems_version: 2.6.13
148
148
  signing_key:
149
149
  specification_version: 4
150
- summary: A Jekyll plugin that bring the functions of typogruby.
150
+ summary: A Jekyll plugin that improves the typography of your Liquid templates.
151
151
  test_files: []