metanorma-utils 1.6.0 → 1.6.1
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/lib/utils/main.rb +5 -5
- data/lib/utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a36ca58dc687a7608f94df44a4f977a7571a687c196217f743af012f05e25b8
|
4
|
+
data.tar.gz: 6a3f38cf066b108a4ace75fa1946b696382963e63212567001eddabaa4a0dfe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98a4fce07065b0b9c03a78d140c64313608ac89bf2f05d93d09f50b196bed93dfc83c54ddcb62474fbd965f22430ad4c5fbba975eb1442796e1e478f10d9433e
|
7
|
+
data.tar.gz: 890a86a2c8c1835e7a4d0bf41cc6b1f77667150b890a1340eaf1d1a8290c8a33560a0ec111af269771fddc0bfddca66c57902c5e7ba7faf1fbbb3f8907c6c24c
|
data/lib/utils/main.rb
CHANGED
@@ -136,10 +136,10 @@ module Metanorma
|
|
136
136
|
def break_up_long_str(text, threshold = LONGSTR_THRESHOLD, nopunct = LONGSTR_NOPUNCT)
|
137
137
|
/^\s*$/.match?(text) and return text
|
138
138
|
text.split(/(?=\s)/).map do |w|
|
139
|
-
if /^\s*$/.match(text) || (w.size <
|
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