jekyll-microtypo 0.1.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '0628e2b5c2f6a7fa37b390567655df106eaad46f'
4
- data.tar.gz: 5f85d6275246f9e39c6a612b781e112c6da7befd
3
+ metadata.gz: 374c7bf0a7bcb54cf2dc2621b7957e350e027531
4
+ data.tar.gz: 0aa11e13446becdabac1645ade47b7af6196dc1d
5
5
  SHA512:
6
- metadata.gz: f4884f750e414590c4f90a7b1bad3a07ec2445b7b8f0f57bc8ea32866790f9a28b73d16a13e930e61e2ed30bd0ef522769b15aa134c66fdd0cfb2f97e37e089d
7
- data.tar.gz: 5533853d81f6e15c26ea6226d182fb4a2d0043471b31b5e5cccff520dc646cf027c8349d7b89b3e009fc5f05ed73b501017edd0a96b1adabae510d6dbb6de796
6
+ metadata.gz: b9047fd528c42e6b25b458d209c281423fcfa4d0e7939475419b613b376ab7324c870929c1c0b43714d2055451e0da446a92d3005be62c11f8606726e17fe106
7
+ data.tar.gz: 9d0e85b371725a224f71756f7dddb256dc1f78683cdb9a3f5b8cdc65b5197c13d4d6b25d59ad3042ec889c2ffb8112501fe2de453a9e83df608b1a38ba244659
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
- # Specify your gem's dependencies in jekyll-post-files.gemspec
4
5
  gemspec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Boris Schapira
3
+ Copyright (c) 2016-present Boris Schapira and contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -3,4 +3,196 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/jekyll-microtypo.svg)](https://badge.fury.io/rb/jekyll-microtypo)
4
4
  [![Gem Downloads](https://img.shields.io/gem/dt/jekyll-microtypo.svg?style=flat)](http://rubygems.org/gems/jekyll-microtypo)
5
5
 
6
+ ## Table of contents / Table des matières
7
+
8
+ - [Jekyll microtypo plugin tag](#jekyll-microtypo-plugin-tag)
9
+ - [Table of contents / Table des matières](#table-of-contents--table-des-mati%C3%A8res)
10
+ - [English](#english)
11
+ - [en_US fixings](#enus-fixings)
12
+ - [Installation](#installation)
13
+ - [Global use](#global-use)
14
+ - [Configuration](#configuration)
15
+ - [Ignore code sections](#ignore-code-sections)
16
+ - [Français](#fran%C3%A7ais)
17
+ - [Corrections fr_FR](#corrections-frfr)
18
+ - [Installation](#installation)
19
+ - [Utilisation générique](#utilisation-g%C3%A9n%C3%A9rique)
20
+ - [Configuration](#configuration)
21
+ - [Ignorer des portions de code](#ignorer-des-portions-de-code)
22
+
23
+ ## English
24
+
6
25
  `jekyll-microtypo` is a [Jekyll](http://jekyllrb.com/) plugin that attempts to fix microtypography for french and english languages.
26
+
27
+ It provides a new filter which takes into parameter the locale of the text to be improved:
28
+
29
+ ```
30
+ {{ content | microtypo: 'en_US' }}
31
+ ```
32
+
33
+ For the moment, `jekyll-microtypo` only sypports fr_FR and en_US.
34
+
35
+ ### en_US fixings
36
+
37
+ - Removal of unnecessary spaces before certain punctuation marks
38
+ - Use of opening and closing single quotation marks
39
+ - Removing unnecessary spaces between amount and currency
40
+ - Replacement of "..." with "..."
41
+ - Use of special characters like ©, ®, ™ or ℗ by typing the letter with parenthesis
42
+
43
+ ### Installation
44
+
45
+ Add `gem 'jekyll-microtypo'` to the `jekyll_plugin` group in your `Gemfile`:
46
+
47
+ ```ruby
48
+ source 'https://rubygems.org'
49
+
50
+ gem 'jekyll'
51
+
52
+ group :jekyll_plugins do
53
+ gem 'jekyll-microtypo'
54
+ end
55
+ ```
56
+
57
+ Then run `bundle` to install the gem.
58
+
59
+ ### Global use
60
+
61
+ A simple way to use `jekyll-microtypo` is to use it into a master layout.
62
+
63
+ Add a `microtypo.html` file to your `_layouts` folder, containing the following snippet:
64
+
65
+ ```liquid
66
+ {{ content | microtypo: page.locale }}
67
+ ```
68
+
69
+ Then, modify all your top-level layouts to inherit from this one. For example, if your only previous top-level layout was `default.html`, add this header:
70
+
71
+ ```
72
+ ---
73
+ layout: microtypo
74
+ ---
75
+
76
+ … The previous content of default.html …
77
+ ```
78
+
79
+ ### Configuration
80
+
81
+ There is no configuration needed for **en_US**.
82
+ For **fr_FR**, you can add a configuration **if you want to hide the inclusive median point abbreviation to screen readers**.
83
+
84
+ Add `microtypo` to your `_config.yml`:
85
+
86
+ ```yaml
87
+ microtypo:
88
+ median: true
89
+ ```
90
+ * Before : `Il·Elle est intéressé·e.`
91
+ * After : `Il<span aria-hidden="true">·Elle</span> est intéressé<span aria-hidden="true">·e</span>.`
92
+
93
+ ### Ignore code sections
94
+
95
+ It is possible to tell `jekyll-microtypo` to ignore one or more sections of code in its corrective operation. To do this, just place the code to ignore between these two comments:
96
+
97
+ ```html
98
+ This content will be fixed.
99
+
100
+ <!-- nomicrotypo -->
101
+ This content will not be fixed
102
+ <!-- endnomicrotypo -->
103
+
104
+ This content will be fixed.
105
+ ```
106
+
107
+ ## Français
108
+
109
+ `jekyll-microtypo` est un plugin [Jekyll](http://jekyllrb.com/) qui permet de corriger la microtypographie de contenus rédigés en anglais ou en français.
110
+
111
+ Il fournit un nouveau filtre qui prend en paramètre la locale du texte à corriger:
112
+
113
+ ```
114
+ {{ content | microtypo: 'en_US' }}
115
+ ```
116
+
117
+ Pour le moment, `jekyll-microtypo` ne supporte que fr_FR et en_US.
118
+
119
+ ### Corrections fr_FR
120
+
121
+ - Remplacement des ordinnaux "1er, 2e" par "1<sup>er</sup>, 2<sup>e</sup>"
122
+ - Remplacement de "n°3" par "n<sup>o</sup>&#8239;3"
123
+ - Utilisation des guillemets à la français
124
+ - Utilisation des guillemets simples ouvrants et fermants
125
+ - Remplacement des pontuations spéciales "?!", "!?", "!!" par les signes adaptés "&#8264;", "&#8265;", "&#8252;"
126
+ - Ajout d'une espace insécable ou fine insécable devant les signes de ponctuation qui le nécessitent
127
+ - Remplacement de l'espace entre des chiffres et certaines unités par une espace fine insécable (attention, l'espace doit être présente à l'origine)
128
+ - Ajout d'une espace insécable avant le montant et les signes "€" ou "$"
129
+ - Ajout d'une espace insécable après un tiret long
130
+ - Remplacement du "x" par un "&times;" dans les multiplications
131
+ - Remplacement de "..." par une vrai éllipse "..."
132
+ - Utilisation de caractères spéciaux comme ©, ®, ™ ou ℗ en utilisant une lettre entourée de parenthèses.
133
+ - **Si configuré** : masquage de la notation abbréviative à base de point médian pour les lecteurs d'écran
134
+
135
+ ### Installation
136
+
137
+ Ajoutez `gem 'jekyll-microtypo'` au groupe `jekyll_plugin` de votre `Gemfile`:
138
+
139
+ ```ruby
140
+ source 'https://rubygems.org'
141
+
142
+ gem 'jekyll'
143
+
144
+ group :jekyll_plugins do
145
+ gem 'jekyll-microtypo'
146
+ end
147
+ ```
148
+
149
+ Puis exécutez `bundle` pour installer la gem.
150
+
151
+ ### Utilisation générique
152
+
153
+ Une manière simple d'utiliser `jekyll-microtypo` est de l'appliquer sur un *layout* de plus haut niveau.
154
+
155
+ Ajoutez un fichier `microtypo.html` à votre dossier `_layouts`, contenant la portion de code suivante:
156
+
157
+ ```liquid
158
+ {{ content | microtypo: page.locale }}
159
+ ```
160
+
161
+ Puis modifier vos autres *layout* de plus haut niveau pour qu'ils héritent de ce *layout*. Par exemple, si votre *layout* de plus haut niveau était `default.html`, ajoutez-lui cet en-tête:
162
+
163
+ ```
164
+ ---
165
+ layout: microtypo
166
+ ---
167
+
168
+ … Le contenu de default.html avant intervention …
169
+ ```
170
+
171
+ ### Configuration
172
+
173
+ Aucune configuration n'est nécessaire pour la locale **en_US**.
174
+ Pour la locale **fr_FR**, vous pouvez ajouter une configuration dans le seul cas où vous voudriez **masquer la syntaxe abbréviative à base de point médian aux lecteurs d'écran**.
175
+
176
+ Dans ce cas, ajoutez `microtypo` à votre `_config.yml`:
177
+
178
+ ```yaml
179
+ microtypo:
180
+ median: true
181
+ ```
182
+
183
+ * Avant : `Il·Elle est intéressé·e.`
184
+ * Après : `Il<span aria-hidden="true">·Elle</span> est intéressé<span aria-hidden="true">·e</span>.`
185
+
186
+ ### Ignorer des portions de code
187
+
188
+ Il est possible d'indiquer à `jekyll-microtypo` d'ignorer une ou plusieurs portions de code dans son opération de correction. Pour cela, il suffit de placer la portion de code entre deux commentaires :
189
+
190
+ ```html
191
+ Ce contenu sera corrigé.
192
+
193
+ <!-- nomicrotypo -->
194
+ Celui-ci ne sera pas corrigé.
195
+ <!-- endnomicrotypo -->
196
+
197
+ Ce contenu sera corrigé.
198
+ ```
data/Rakefile CHANGED
@@ -1,8 +1,24 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
1
+ # frozen_string_literal: true
3
2
 
4
- task :default => :spec
3
+ require "rubygems"
4
+ require "bundler"
5
+ require "bundler/gem_tasks"
5
6
 
6
- Rake::TestTask.new do |t|
7
- t.libs << 'test'
7
+ begin
8
+ Bundler.setup(:default, :development, :test)
9
+ rescue Bundler::BundlerError => e
10
+ warn e.message
11
+ warn "Run `bundle install` to install missing gems"
12
+ exit e.status_code
8
13
  end
14
+
15
+ require "rake"
16
+ require "rake/testtask"
17
+
18
+ Rake::TestTask.new(:test) do |test|
19
+ test.libs << "lib" << "test"
20
+ test.pattern = "test/test_*.rb"
21
+ test.warning = false
22
+ end
23
+
24
+ task :default => :test
@@ -1 +1,3 @@
1
- require 'jekyll/microtypo'
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll/microtypo"
@@ -103,9 +103,25 @@ module Jekyll
103
103
 
104
104
  end
105
105
 
106
+ # single quotes
107
+ input.gsub!(/(\s)'([[:alpha:]])/, '\1‘\2'.freeze)
108
+ input.gsub!(/([[:alpha:]])'(\s)/, '\1’\2'.freeze)
109
+ input.gsub!(/(\d)''/, '\1’’'.freeze)
110
+ input.gsub!(/(\d)'/, '\1’'.freeze)
111
+
112
+ # Apostrophe
113
+ input.gsub!(/([[:alpha:]])'([[:alpha:]])/, '\1’\2'.freeze)
114
+
106
115
  # Elipsis
107
116
  input.gsub!('...', '&#8230;'.freeze)
108
117
 
118
+ # Special characters
119
+ input.gsub!(/\([c|C]\)/, '©'.freeze)
120
+ input.gsub!(/\([p|P]\)/, '℗'.freeze)
121
+ input.gsub!(/\([r|R]\)/, '®'.freeze)
122
+ input.gsub!(/\((tm|TM)\)/, '™'.freeze)
123
+ input.gsub!(/\+-/, '±'.freeze)
124
+
109
125
  array_response.push input
110
126
  end
111
127
  end
@@ -113,8 +129,8 @@ module Jekyll
113
129
 
114
130
  # Clean empty lines
115
131
  array_response.join.gsub(/\A\s*\n$/, ''.freeze)
132
+ end
116
133
  end
117
- end
118
- end
134
+ end
119
135
 
120
136
  Liquid::Template.register_filter(Jekyll::Microtypo)
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Jekyll
2
4
  module Microtypo
3
- VERSION = '0.1.2'.freeze
5
+ VERSION = "0.2.1".freeze
4
6
  end
5
7
  end
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: 0.1.2
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Schapira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -36,76 +36,62 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.12'
39
+ version: '1.15'
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: '1.12'
46
+ version: '1.15'
47
47
  - !ruby/object:Gem::Dependency
48
- name: rake
48
+ name: minitest
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '10.0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '10.0'
61
- - !ruby/object:Gem::Dependency
62
- name: rubocop
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
53
+ version: '5.8'
54
+ - - ">="
66
55
  - !ruby/object:Gem::Version
67
- version: 0.49.0
56
+ version: 5.8.4
68
57
  type: :development
69
58
  prerelease: false
70
59
  version_requirements: !ruby/object:Gem::Requirement
71
60
  requirements:
72
61
  - - "~>"
73
62
  - !ruby/object:Gem::Version
74
- version: 0.49.0
63
+ version: '5.8'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 5.8.4
75
67
  - !ruby/object:Gem::Dependency
76
- name: minitest
68
+ name: rake
77
69
  requirement: !ruby/object:Gem::Requirement
78
70
  requirements:
79
71
  - - "~>"
80
72
  - !ruby/object:Gem::Version
81
- version: '5.8'
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: 5.8.4
73
+ version: '12.0'
85
74
  type: :development
86
75
  prerelease: false
87
76
  version_requirements: !ruby/object:Gem::Requirement
88
77
  requirements:
89
78
  - - "~>"
90
79
  - !ruby/object:Gem::Version
91
- version: '5.8'
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: 5.8.4
80
+ version: '12.0'
95
81
  - !ruby/object:Gem::Dependency
96
- name: gem-release
82
+ name: rubocop
97
83
  requirement: !ruby/object:Gem::Requirement
98
84
  requirements:
99
85
  - - "~>"
100
86
  - !ruby/object:Gem::Version
101
- version: '1.0'
87
+ version: 0.51.0
102
88
  type: :development
103
89
  prerelease: false
104
90
  version_requirements: !ruby/object:Gem::Requirement
105
91
  requirements:
106
92
  - - "~>"
107
93
  - !ruby/object:Gem::Version
108
- version: '1.0'
94
+ version: 0.51.0
109
95
  description: " Jekyll plugin that improves microtypography\n"
110
96
  email:
111
97
  - contact@borisschapira.com
@@ -132,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
118
  requirements:
133
119
  - - ">="
134
120
  - !ruby/object:Gem::Version
135
- version: 2.0.0
121
+ version: 2.1.0
136
122
  required_rubygems_version: !ruby/object:Gem::Requirement
137
123
  requirements:
138
124
  - - ">="
@@ -140,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
126
  version: '0'
141
127
  requirements: []
142
128
  rubyforge_project:
143
- rubygems_version: 2.5.2
129
+ rubygems_version: 2.6.14
144
130
  signing_key:
145
131
  specification_version: 4
146
132
  summary: Jekyll plugin that improves microtypography