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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3234e3bc74a4ba02f150016c23db7e9b3d03386ae9f78ac42e3a64d78e31556e
4
- data.tar.gz: 5ac7ae07a58d238b199f7e4cb9b79175e6ea0e99dfa5185358fffb579906de0f
3
+ metadata.gz: 240c5f31b6dad1797c4beba192aee96bd27bb1102c0204f5519e352732e57e6e
4
+ data.tar.gz: 35ca70ee292b96c4fc707ea8a921da6376fa4b5b1742b9e1dbd01f440573da5f
5
5
  SHA512:
6
- metadata.gz: fc1e64c876f4d3bafd6996bd10421c810370ca3b512f702a1a09079a49d242773c90206f68a8f1187a574f13a7fbd9c7b4ec6dd122be18b9e7d6568785483066
7
- data.tar.gz: dde8f1ea187e9cf6e9d80972c3b785c499a2c55fd6c8e9f3550e666a6b0e69ae711ba27c3e604d0c5e9f0fbe085a28ee45c240e5f969995497a5fd5b81c4aa59
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(/(?=\s)/).map do |w|
139
- if /^\s*$/.match(text) || (w.size < LONGSTR_THRESHOLD) then w
138
+ text.split(/(?=(?:\s|-))/).map do |w|
139
+ if /^\s*$/.match(text) || (w.size < threshold) then w
140
140
  else
141
- w.scan(/.{,#{LONGSTR_THRESHOLD}}/o).map.with_index do |w1, i|
142
- w1.size < LONGSTR_THRESHOLD ? w1 : break_up_long_str1(w1, i + 1)
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 % LONGSTR_NOPUNCT).zero? and
166
+ (iteration % nopunct).zero? and
167
167
  text += "\u00ad" # force soft hyphen
168
168
  text
169
169
  else
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.6.0".freeze
3
+ VERSION = "1.6.2".freeze
4
4
  end
5
5
  end
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.0
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-10-09 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor