orthotypo 1.0.3 → 1.0.4

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: 818fb1bd3d3eb901d75f4e02210bf77fd7602b1d032003a3dac4f8a74d82f947
4
- data.tar.gz: eef332835ee689969703219a8ddb6807c2f7d4d6d0e066ec71e9b1d68010e3ed
3
+ metadata.gz: b39450aef34318976f5708d105828cbc0792ff8d6c81a1f3c3eb51d2ce27713b
4
+ data.tar.gz: d2a701e7525d6babcf406c702fc1e181ecae671840344df66f0d3d02538a702a
5
5
  SHA512:
6
- metadata.gz: 6055df7db77d195116bd55015ceecc22c7799991a13cfbd0f7fc01868afe16bf6c1578763a972c4ceee032fb72736388353463468cfd8a1596c8c54b659f854c
7
- data.tar.gz: 6643636a85073aecf213a8c533882fe960d275acead499b91cf92fa7ce987de006d9951b520e6077e234b951c44ff825002f1af692edcfafd1291d072942dcc7
6
+ metadata.gz: 8066e337bf64b472bf9610e5e96c41819c5e0148a8725d22781c3d26a987835cc098745f8f12de4d3f087d745186006f6fe11f8fd7daa64e870d0175e458f3f6
7
+ data.tar.gz: b9d9e4398cbc8e7516f6eb475abc0a22ae291b12b38706ed08bbc18e568abb415da8ec45ed7a6a3658a911efe68df0b6d15b0950b1f007d108dadf6de5ab1e0d
@@ -0,0 +1,18 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@2.1.1
4
+ jobs:
5
+ test:
6
+ docker:
7
+ - image: cimg/ruby:3.3
8
+ steps:
9
+ - checkout
10
+ - ruby/install-deps
11
+ - run:
12
+ name: Run tests
13
+ command: bundle exec rake
14
+ workflows:
15
+ version: 2
16
+ deploy:
17
+ jobs:
18
+ - test
data/Gemfile CHANGED
@@ -6,5 +6,4 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
-
10
9
  gem "rubocop", "~> 1.21"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orthotypo (1.0.3)
4
+ orthotypo (1.0.4)
5
5
  htmlentities
6
6
  nokogiri
7
7
 
@@ -18,6 +18,8 @@ GEM
18
18
  racc (~> 1.4)
19
19
  nokogiri (1.16.2-x86_64-darwin)
20
20
  racc (~> 1.4)
21
+ nokogiri (1.16.2-x86_64-linux)
22
+ racc (~> 1.4)
21
23
  parallel (1.24.0)
22
24
  parser (3.3.0.5)
23
25
  ast (~> 2.4.1)
@@ -42,8 +44,10 @@ GEM
42
44
  rspec-nc (0.3.0)
43
45
  rspec (>= 3)
44
46
  terminal-notifier (>= 1.4)
45
- rspec-support (3.13.0)
46
- rubocop (1.60.2)
47
+ rspec-support (3.13.1)
48
+ rspec_junit_formatter (0.6.0)
49
+ rspec-core (>= 2, < 4, != 2.12.0)
50
+ rubocop (1.62.1)
47
51
  json (~> 2.3)
48
52
  language_server-protocol (>= 3.17.0)
49
53
  parallel (~> 1.10)
@@ -51,11 +55,11 @@ GEM
51
55
  rainbow (>= 2.2.2, < 4.0)
52
56
  regexp_parser (>= 1.8, < 3.0)
53
57
  rexml (>= 3.2.5, < 4.0)
54
- rubocop-ast (>= 1.30.0, < 2.0)
58
+ rubocop-ast (>= 1.31.1, < 2.0)
55
59
  ruby-progressbar (~> 1.7)
56
60
  unicode-display_width (>= 2.4.0, < 3.0)
57
- rubocop-ast (1.30.0)
58
- parser (>= 3.2.1.0)
61
+ rubocop-ast (1.31.2)
62
+ parser (>= 3.3.0.4)
59
63
  ruby-progressbar (1.13.0)
60
64
  terminal-notifier (2.0.0)
61
65
  unicode-display_width (2.5.0)
@@ -64,6 +68,7 @@ PLATFORMS
64
68
  arm64-darwin-22
65
69
  arm64-darwin-23
66
70
  x86_64-darwin-22
71
+ x86_64-linux
67
72
 
68
73
  DEPENDENCIES
69
74
  byebug
@@ -71,6 +76,7 @@ DEPENDENCIES
71
76
  rake (~> 13.0)
72
77
  rspec
73
78
  rspec-nc
79
+ rspec_junit_formatter
74
80
  rubocop (~> 1.21)
75
81
 
76
82
  BUNDLED WITH
@@ -114,7 +114,7 @@ module Orthotypo
114
114
  end
115
115
 
116
116
  def preserve_precious_things
117
- @precious_things = []
117
+ @precious_things = {}
118
118
  @nokogiri.traverse do |node|
119
119
  if node.text?
120
120
  has_leading_space = node.content.start_with? SPACE
@@ -143,16 +143,17 @@ module Orthotypo
143
143
 
144
144
  def store_precious_thing(string)
145
145
  # Create token identifier
146
- token = "#{PRECIOUS_TOKEN}#{@precious_things.length}"
146
+ uid = SecureRandom.hex
147
+ token = "#{PRECIOUS_TOKEN}-#{uid}"
147
148
  # Store value
148
- @precious_things << string
149
+ @precious_things[uid] = string
149
150
  # Return identifier
150
151
  token
151
152
  end
152
153
 
153
154
  def restore_precious_things
154
- @precious_things.each_with_index do |value, index|
155
- @ortho.gsub! "#{PRECIOUS_TOKEN}#{index}", value
155
+ @precious_things.each do |uid, value|
156
+ @ortho.gsub! "#{PRECIOUS_TOKEN}-#{uid}", value
156
157
  end
157
158
  end
158
159
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orthotypo
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
data/lib/orthotypo.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "htmlentities"
4
4
  require "nokogiri"
5
+ require "securerandom"
5
6
  require "uri"
6
7
  require_relative "orthotypo/analyzer"
7
8
  require_relative "orthotypo/composer"
data/orthotypo.gemspec CHANGED
@@ -25,5 +25,6 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "rspec"
27
27
  spec.add_development_dependency "rspec-nc"
28
+ spec.add_development_dependency "rspec_junit_formatter"
28
29
  spec.add_development_dependency "byebug"
29
30
  end
@@ -97,4 +97,12 @@ describe Orthotypo::Composer::Fr do
97
97
  # expect("Il en compte 1,000, 10,000, 36,742, 500,000, puis 1,000,000, 25,000,000, etc.".ortho).to(eq("Il en compte 1 000, 10 000, 36 742, 500 000, puis 1 000 000, 25 000 000, etc."))
98
98
  # expect("Le numéro gagnant est le 3 541 672.".ortho).to(eq("Le numéro gagnant est le 3541672."))
99
99
  end
100
+
101
+ it 'preserves all URLs' do
102
+ # Generates '<a href="https://example0.fr\">Example 0</a><a href="https://example1.fr\">Example 1</a><a href="https://example2.fr\">Example 2</a>...'
103
+ input = (0..12).map { |n|
104
+ "<a href=\"https://example#{n}.fr\">Example #{n}</a>"
105
+ }.join
106
+ expect(input.ortho).to(eq(input))
107
+ end
100
108
  end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,2 @@
1
1
  require 'byebug'
2
- require 'Orthotypo'
2
+ require 'orthotypo'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthotypo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Levy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-15 00:00:00.000000000 Z
11
+ date: 2024-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec_junit_formatter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: byebug
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +103,7 @@ executables: []
89
103
  extensions: []
90
104
  extra_rdoc_files: []
91
105
  files:
106
+ - ".circleci/config.yml"
92
107
  - ".gitignore"
93
108
  - ".rubocop.yml"
94
109
  - CHANGELOG.md
@@ -140,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
155
  - !ruby/object:Gem::Version
141
156
  version: '0'
142
157
  requirements: []
143
- rubygems_version: 3.5.5
158
+ rubygems_version: 3.4.10
144
159
  signing_key:
145
160
  specification_version: 4
146
161
  summary: Pour un texte correctement typographié