jekyll-microtypo 2.0.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5e698d1f87752dc8ae5ab5de6b61031d74c1ed7f804cf70ffd6d1a978a3e6f6
4
- data.tar.gz: 5df5e26d4b1c998917c1cf05bb9a5fee30f45a7af24577731f24ada391b791b7
3
+ metadata.gz: eec52cfd9feb231b5bc40209fb735c9e521eb4d2f84d36dce25a4182c63d783f
4
+ data.tar.gz: 54c9788e496a0449b133b3985d10ebf0245a6509688ec3cdfda53bcc8c45bfb2
5
5
  SHA512:
6
- metadata.gz: 1a83c64a7eee57fe548932d605033646f0b854bce0d27bc09f9b4e7ebe1ef850af93992f7a849bb8687ac2f61dec8b972a41a7c9e2a4ca41e6735e4e13948cf3
7
- data.tar.gz: 5eb91c0fd1b6421bf3b25d7631886592eedd6186054c25fde81a665626ded81f6ed0f4e7835e6db29afa13c4503ed8dd4c5a7ed71f542b946311f748f538a8c2
6
+ metadata.gz: 4079311e4e784d3449d7b60973cd2be2e4e4bd082667656812a7de87b6c3d12fdbddc4278bd9e3783fc92449fe1a14bff7ff1f3f089dfc7be85c6af312d7fe1b
7
+ data.tar.gz: a6c821dd67220c32e1c399b0dd19a056671501459ec071dfca3e07532d2583b9d1b3716b44044c082d80a1b21e40c7830461447d11374bb5a001f46201b92c51
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Microtypo
5
- VERSION = "2.0.3"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  end
@@ -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, "&#8239;")
97
+
86
98
  # Ordinals
87
- input.gsub!(%r!(\s)(\d+)(e|è)(r|me|re)?([\s.,\)])!, '\1\2<sup>\3\4</sup>\5')
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>&#8239;\1')
@@ -92,7 +104,7 @@ module Jekyll
92
104
  # French Guillemets
93
105
  input.gsub!(%r!(&rdquo;|”|»)<a !, "«&#8239;<a ")
94
106
  input.gsub!(%r/(&ldquo;|“|«)(?!&#8239;)(\s|&nbsp;| )*/, "«&#8239;")
95
- input.gsub!(%r/(\s|&nbsp;| )*(?!&#8239;)(&rdquo;|”|»)/, "&#8239;»")
107
+ input.gsub!(%r/(\s|&nbsp;| )*(?<!&#8239;)(&rdquo;|”|»)/, "&#8239;»")
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&nbsp;&times;&nbsp;')
112
124
 
113
- # Non-breaking space before '%' and units (< 4 letters)
114
- input.gsub!(%r!\s+(\d+)\s+([[:alpha:]]|%)!, ' \1&nbsp;\2')
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&nbsp;\2')
115
127
 
116
128
  # Thin non-breaking space before ;', '!', '?'
117
129
  input.gsub!(%r/ (;|\!|\?)([^\w!]|$)/, '&#8239;\1\2')
@@ -120,23 +132,29 @@ module Jekyll
120
132
  input.gsub!(" :", "&nbsp;:")
121
133
 
122
134
  # Currencies
123
- input.gsub!(%r!(\d+)\s*($|€)!, '\1&nbsp;\2')
135
+ input.gsub!(%r!(\d+)\s*€!, '\1&nbsp;€')
124
136
 
125
137
  # nbsp after middle dash (dialogs)
126
138
  input.gsub!(%r!(—|&mdash;)\s!, '\1&nbsp;')
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!(\s)(\d+)(st|th|rd|nd)([\s.,\)])!, '\1\2<sup>\3</sup>\4')
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!($|€)\s*(\d+)!, '\1\2')
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,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-microtypo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Schapira
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-11-19 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: jekyll
@@ -151,6 +152,7 @@ homepage: https://borisschapira.github.io/jekyll-microtypo/
151
152
  licenses:
152
153
  - MIT
153
154
  metadata: {}
155
+ post_install_message:
154
156
  rdoc_options: []
155
157
  require_paths:
156
158
  - lib
@@ -165,7 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
167
  - !ruby/object:Gem::Version
166
168
  version: '0'
167
169
  requirements: []
168
- rubygems_version: 4.0.19
170
+ rubygems_version: 3.0.3.1
171
+ signing_key:
169
172
  specification_version: 4
170
173
  summary: Jekyll plugin that improves microtypography
171
174
  test_files: []