jekyll-microtypo 2.0.2 → 2.1.0
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 +4 -4
- data/lib/jekyll/microtypo/version.rb +1 -1
- data/lib/jekyll/microtypo.rb +25 -7
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eec52cfd9feb231b5bc40209fb735c9e521eb4d2f84d36dce25a4182c63d783f
|
|
4
|
+
data.tar.gz: 54c9788e496a0449b133b3985d10ebf0245a6509688ec3cdfda53bcc8c45bfb2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4079311e4e784d3449d7b60973cd2be2e4e4bd082667656812a7de87b6c3d12fdbddc4278bd9e3783fc92449fe1a14bff7ff1f3f089dfc7be85c6af312d7fe1b
|
|
7
|
+
data.tar.gz: a6c821dd67220c32e1c399b0dd19a056671501459ec071dfca3e07532d2583b9d1b3716b44044c082d80a1b21e40c7830461447d11374bb5a001f46201b92c51
|
data/lib/jekyll/microtypo.rb
CHANGED
|
@@ -82,9 +82,21 @@ module Jekyll
|
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
+
# Groups digit sequences of five or more; four-digit values such as years are left unchanged.
|
|
86
|
+
def format_thousands(input, separator)
|
|
87
|
+
input.gsub!(%r~(?<!&#)(?<![\p{L}\d_.,])\d{5,}(?![\p{L}\d_]|\s*:)~) do |number|
|
|
88
|
+
number.gsub(%r~(?<=\d)(?=(?:\d{3})+$)~) { separator }
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Applies French punctuation and number formatting
|
|
85
93
|
def fix_microtypo_fr(input)
|
|
94
|
+
|
|
95
|
+
# Thousand separators for numbers with > 4 digits
|
|
96
|
+
format_thousands(input, " ")
|
|
97
|
+
|
|
86
98
|
# Ordinals
|
|
87
|
-
input.gsub!(%r!(
|
|
99
|
+
input.gsub!(%r!(^|\s)(\d+)(e|è)(r|me|re)?([\s.,\)]|$)!, '\1\2<sup>\3\4</sup>\5')
|
|
88
100
|
|
|
89
101
|
# Num
|
|
90
102
|
input.gsub!(%r!n°\s*(\d)!, 'n<sup>o</sup> \1')
|
|
@@ -92,7 +104,7 @@ module Jekyll
|
|
|
92
104
|
# French Guillemets
|
|
93
105
|
input.gsub!(%r!(”|”|»)<a !, "« <a ")
|
|
94
106
|
input.gsub!(%r/(“|“|«)(?! )(\s| | )*/, "« ")
|
|
95
|
-
input.gsub!(%r/(\s| | )*(
|
|
107
|
+
input.gsub!(%r/(\s| | )*(?<! )(”|”|»)/, " »")
|
|
96
108
|
|
|
97
109
|
settings = Microtypo.settings(@context.registers[:site].config)
|
|
98
110
|
|
|
@@ -110,8 +122,8 @@ module Jekyll
|
|
|
110
122
|
# Times
|
|
111
123
|
input.gsub!(%r!\s+(\d+)\s*x\s*(?=\d)!, ' \1 × ')
|
|
112
124
|
|
|
113
|
-
# Non-breaking space before '%' and units
|
|
114
|
-
input.gsub!(%r
|
|
125
|
+
# Non-breaking space before '%' and recognized units
|
|
126
|
+
input.gsub!(%r~\s+(\d+)\s+(%|pixels?|kHz|MHz|µm|nm|km|cm|mm|dm|kg|mg|min|ms|mA|kV|kW|MW|mL|cL|Ko|Mo|Go|To|°C|°F|Hz|px|m|g|t|s|h|A|V|W|L|o)(?![\p{L}\d])~, ' \1 \2')
|
|
115
127
|
|
|
116
128
|
# Thin non-breaking space before ;', '!', '?'
|
|
117
129
|
input.gsub!(%r/ (;|\!|\?)([^\w!]|$)/, ' \1\2')
|
|
@@ -120,23 +132,29 @@ module Jekyll
|
|
|
120
132
|
input.gsub!(" :", " :")
|
|
121
133
|
|
|
122
134
|
# Currencies
|
|
123
|
-
input.gsub!(%r!(\d+)\s
|
|
135
|
+
input.gsub!(%r!(\d+)\s*€!, '\1 €')
|
|
124
136
|
|
|
125
137
|
# nbsp after middle dash (dialogs)
|
|
126
138
|
input.gsub!(%r!(—|—)\s!, '\1 ')
|
|
127
139
|
end
|
|
128
140
|
|
|
141
|
+
# Applies US English punctuation and number formatting
|
|
129
142
|
def fix_microtypo_us(input)
|
|
143
|
+
|
|
144
|
+
# Thousand separators for numbers with > 4 digits
|
|
145
|
+
format_thousands(input, ",")
|
|
146
|
+
|
|
130
147
|
# Ordinals
|
|
131
|
-
input.gsub!(%r!(
|
|
148
|
+
input.gsub!(%r!(^|\s)(\d+)(st|th|rd|nd)([\s.,\)]|$)!, '\1\2<sup>\3</sup>\4')
|
|
132
149
|
|
|
133
150
|
# Remove useless spaces
|
|
134
151
|
input.gsub!(%r/ (:|%|;|\!|\?)([^\w!]|$)/, '\1\2')
|
|
135
152
|
|
|
136
153
|
# Currencies
|
|
137
|
-
input.gsub!(%r!(
|
|
154
|
+
input.gsub!(%r!(\$|€)\s*(\d+)!, '\1\2')
|
|
138
155
|
end
|
|
139
156
|
|
|
157
|
+
# Applies locale-specific fixes first, then shared quote, apostrophe, and character replacements.
|
|
140
158
|
def fix_microtypo(input, locale, bucket)
|
|
141
159
|
if locale == "fr_FR"
|
|
142
160
|
fix_microtypo_fr(input)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-microtypo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Boris Schapira
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -36,14 +36,14 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
39
|
+
version: '4.0'
|
|
40
40
|
type: :development
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
46
|
+
version: '4.0'
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: minitest
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -152,7 +152,7 @@ homepage: https://borisschapira.github.io/jekyll-microtypo/
|
|
|
152
152
|
licenses:
|
|
153
153
|
- MIT
|
|
154
154
|
metadata: {}
|
|
155
|
-
post_install_message:
|
|
155
|
+
post_install_message:
|
|
156
156
|
rdoc_options: []
|
|
157
157
|
require_paths:
|
|
158
158
|
- lib
|
|
@@ -167,8 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
167
167
|
- !ruby/object:Gem::Version
|
|
168
168
|
version: '0'
|
|
169
169
|
requirements: []
|
|
170
|
-
rubygems_version: 3.
|
|
171
|
-
signing_key:
|
|
170
|
+
rubygems_version: 3.0.3.1
|
|
171
|
+
signing_key:
|
|
172
172
|
specification_version: 4
|
|
173
173
|
summary: Jekyll plugin that improves microtypography
|
|
174
174
|
test_files: []
|