metanorma-utils 1.6.0 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/utils/main.rb +6 -6
- data/lib/utils/version.rb +1 -1
- 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: 240c5f31b6dad1797c4beba192aee96bd27bb1102c0204f5519e352732e57e6e
|
4
|
+
data.tar.gz: 35ca70ee292b96c4fc707ea8a921da6376fa4b5b1742b9e1dbd01f440573da5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58d0a2622468e63bf96d5248d07adcc76064db527a42029b5e559f58cddd8644340d7304dfc18c1537d411e37be51e0953acc08d23c665286646aa0725d184b1
|
7
|
+
data.tar.gz: e45e4a67bfde7aad5bf8e6935fade99ee40db4c6e6d0bb41045dc12344aea5a2ab1c999f2713e1a939643221c632e69e86e729cd982ea50d0014053da01af6d1
|
data/lib/utils/main.rb
CHANGED
@@ -135,11 +135,11 @@ module Metanorma
|
|
135
135
|
# with soft hyphen
|
136
136
|
def break_up_long_str(text, threshold = LONGSTR_THRESHOLD, nopunct = LONGSTR_NOPUNCT)
|
137
137
|
/^\s*$/.match?(text) and return text
|
138
|
-
text.split(/(
|
139
|
-
if /^\s*$/.match(text) || (w.size <
|
138
|
+
text.split(/(?=(?:\s|-))/).map do |w|
|
139
|
+
if /^\s*$/.match(text) || (w.size < threshold) then w
|
140
140
|
else
|
141
|
-
w.scan(/.{,#{
|
142
|
-
w1.size <
|
141
|
+
w.scan(/.{,#{threshold}}/o).map.with_index do |w1, i|
|
142
|
+
w1.size < threshold ? w1 : break_up_long_str1(w1, i + 1, nopunct)
|
143
143
|
end.join
|
144
144
|
end
|
145
145
|
end.join
|
@@ -160,10 +160,10 @@ module Metanorma
|
|
160
160
|
(?<=\p{Ll}\p{Ll})(?=\p{Lu}\p{Ll}\p{Ll}) # 2 lowerc / upperc, 2 lowerc
|
161
161
|
}x.freeze
|
162
162
|
|
163
|
-
def break_up_long_str1(text, iteration)
|
163
|
+
def break_up_long_str1(text, iteration, nopunct)
|
164
164
|
s, separator = break_up_long_str2(text)
|
165
165
|
if s.size == 1 # could not break up
|
166
|
-
(iteration %
|
166
|
+
(iteration % nopunct).zero? and
|
167
167
|
text += "\u00ad" # force soft hyphen
|
168
168
|
text
|
169
169
|
else
|
data/lib/utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|