orthotypo 1.0.2 → 1.0.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/orthotypo/analyzer.rb +6 -4
- data/lib/orthotypo/version.rb +1 -1
- data/spec/analyzer_spec.rb +2 -0
- data/spec/composer/fr_spec.rb +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 818fb1bd3d3eb901d75f4e02210bf77fd7602b1d032003a3dac4f8a74d82f947
|
4
|
+
data.tar.gz: eef332835ee689969703219a8ddb6807c2f7d4d6d0e066ec71e9b1d68010e3ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6055df7db77d195116bd55015ceecc22c7799991a13cfbd0f7fc01868afe16bf6c1578763a972c4ceee032fb72736388353463468cfd8a1596c8c54b659f854c
|
7
|
+
data.tar.gz: 6643636a85073aecf213a8c533882fe960d275acead499b91cf92fa7ce987de006d9951b520e6077e234b951c44ff825002f1af692edcfafd1291d072942dcc7
|
data/Gemfile.lock
CHANGED
data/lib/orthotypo/analyzer.rb
CHANGED
@@ -2,10 +2,12 @@ module Orthotypo
|
|
2
2
|
class Analyzer
|
3
3
|
|
4
4
|
def self.url?(string)
|
5
|
-
|
6
|
-
|
5
|
+
uri = URI.parse(string)
|
6
|
+
uri.class != URI::Generic
|
7
|
+
rescue URI::InvalidURIError
|
8
|
+
false
|
7
9
|
end
|
8
|
-
|
10
|
+
|
9
11
|
def self.email?(string)
|
10
12
|
string =~ /\A#{URI::MailTo::EMAIL_REGEXP}\z/ ? true : false
|
11
13
|
end
|
@@ -13,6 +15,6 @@ module Orthotypo
|
|
13
15
|
def self.precious?(string)
|
14
16
|
email?(string) || url?(string)
|
15
17
|
end
|
16
|
-
|
18
|
+
|
17
19
|
end
|
18
20
|
end
|
data/lib/orthotypo/version.rb
CHANGED
data/spec/analyzer_spec.rb
CHANGED
@@ -3,6 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Orthotypo::Analyzer do
|
4
4
|
it 'find urls' do
|
5
5
|
expect(Orthotypo::Analyzer.url?("https://unsplash.com/@lusvardi?utm_source=osuny")).to be true
|
6
|
+
expect(Orthotypo::Analyzer.url?("https://hal.science/hal-02455856")).to be true
|
7
|
+
expect(Orthotypo::Analyzer.url?("mailto:test@example.com")).to be true
|
6
8
|
expect(Orthotypo::Analyzer.url?("mot:")).to be false
|
7
9
|
end
|
8
10
|
end
|
data/spec/composer/fr_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Orthotypo::Composer::Fr do
|
|
5
5
|
it 'adds spaces before double punctuation marks' do
|
6
6
|
expect("mot: suite".ortho).to(eq("mot : suite"))
|
7
7
|
expect("é: suite".ortho).to(eq("é : suite"))
|
8
|
-
# Pas automatisable, parce
|
8
|
+
# Pas automatisable, parce qu'on peut écrire une heure 11:20
|
9
9
|
# expect("1: suite".ortho).to(eq("1 : suite"))
|
10
10
|
expect("mot; suite".ortho).to(eq("mot ; suite"))
|
11
11
|
expect("mot!".ortho).to(eq("mot !"))
|
@@ -27,11 +27,12 @@ describe Orthotypo::Composer::Fr do
|
|
27
27
|
|
28
28
|
it 'fixes space after simple punctuation' do
|
29
29
|
expect("mot,suite".ortho).to(eq("mot, suite"))
|
30
|
+
expect("84.Paris".ortho).to(eq("84.Paris"))
|
30
31
|
expect("etudiant.gouv.fr".ortho).to(eq("etudiant.gouv.fr"))
|
31
32
|
expect("4,5".ortho).to(eq("4,5"))
|
32
33
|
expect("4.5".ortho).to(eq("4.5"))
|
33
|
-
# Le test suivant, on ne fait rien, on ne peut pas résoudre, car s'apparente au cas précédent.
|
34
|
-
expect("Il est né en 1984.5 maisons en paille".ortho).to(eq("Il est né en 1984.5 maisons en paille"))
|
34
|
+
# Le test suivant, on ne fait rien, on ne peut pas résoudre, car s'apparente au cas précédent (1984.5)
|
35
|
+
# expect("Il est né en 1984.5 maisons en paille".ortho).to(eq("Il est né en 1984. 5 maisons en paille"))
|
35
36
|
end
|
36
37
|
|
37
38
|
it 'fixes quotation marks' do
|
@@ -68,6 +69,10 @@ describe Orthotypo::Composer::Fr do
|
|
68
69
|
expect("A parallel between wildlife and urban ensembles.\r\rShot during summer 2014 on our trip from north to south of Portugal.".ortho).to(eq("A parallel between wildlife and urban ensembles.<br><br>Shot during summer 2014 on our trip from north to south of Portugal."))
|
69
70
|
end
|
70
71
|
|
72
|
+
it 'preserves URLs' do
|
73
|
+
expect("https://hal.science/hal-02455856".ortho).to(eq("https://hal.science/hal-02455856"))
|
74
|
+
end
|
75
|
+
|
71
76
|
# https://www.scribbr.fr/elements-linguistiques/les-espaces/
|
72
77
|
it 'tests de Justine Debret' do
|
73
78
|
# FIXME
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthotypo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Levy
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.5.5
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Pour un texte correctement typographié
|