isodoc 2.5.6 → 2.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/function/cleanup.rb +19 -14
- data/lib/isodoc/html_function/html.rb +0 -2
- data/lib/isodoc/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: 89b2a927f8f452dd13667b90a02e9871472784e620c85978a83d6fd52015902b
|
4
|
+
data.tar.gz: f76d973900f03358f4411a8b479db06544e3d7ecc52971cd0c5afe60334046bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aecc80230f4d1cde0232702931d07290c340f98c3a5e93a81603fed8c7775a1fca6dbf29cf09aa8141aece7fa3befb6d583c70690cf2cda02fcf50ce5bf75848
|
7
|
+
data.tar.gz: fc2d6d6fa85a1dc0edf1735068b940084b21fe20442158bc18307e9ae77581875dbf2b66be5cc4847bd2eb1096063b959c9df9695d356963e879c9c83e6a9e3b
|
@@ -30,33 +30,38 @@ module IsoDoc
|
|
30
30
|
|
31
31
|
docxml.xpath("//td | //th").each do |d|
|
32
32
|
d.traverse do |n|
|
33
|
-
|
34
|
-
|
35
|
-
n.
|
36
|
-
break_up_long_strings(n.text),
|
37
|
-
))
|
33
|
+
n.text? or next
|
34
|
+
ret = break_up_long_str(n.text)
|
35
|
+
n.content = ret
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
42
|
-
|
43
|
-
|
40
|
+
LONGSTR_THRESHOLD = 10
|
41
|
+
LONGSTR_NOPUNCT = 2
|
44
42
|
|
43
|
+
def break_up_long_str(text)
|
44
|
+
/^\s*$/.match?(text) and return text
|
45
45
|
text.split(/(?=\s)/).map do |w|
|
46
|
-
if /^\s*$/.match(text) || (w.size <
|
46
|
+
if /^\s*$/.match(text) || (w.size < LONGSTR_THRESHOLD) then w
|
47
47
|
else
|
48
|
-
w.scan(/.{
|
49
|
-
w1.size <
|
48
|
+
w.scan(/.{,#{LONGSTR_THRESHOLD}}/o).map.with_index do |w1, i|
|
49
|
+
w1.size < LONGSTR_THRESHOLD ? w1 : break_up_long_str1(w1, i + 1)
|
50
50
|
end.join
|
51
51
|
end
|
52
52
|
end.join
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
# break on punct every LONGSTRING_THRESHOLD chars
|
56
|
+
# break regardless every LONGSTRING_THRESHOLD * LONGSTR_NOPUNCT
|
57
|
+
def break_up_long_str1(text, iteration)
|
58
|
+
s = text.split(%r{(?<=[,.?+;/=(\[])})
|
59
|
+
if s.size == 1
|
60
|
+
(iteration % LONGSTR_NOPUNCT).zero? and
|
61
|
+
text += "\u200b"
|
62
|
+
text
|
58
63
|
else
|
59
|
-
s[-1] = "
|
64
|
+
s[-1] = "\u200b#{s[-1]}"
|
60
65
|
s.join
|
61
66
|
end
|
62
67
|
end
|
data/lib/isodoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.7
|
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-06-
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html2doc
|