isodoc 2.5.6 → 2.5.8
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/function/lists.rb +1 -2
- 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: 69483536ae8b9bb773ddbb3e3d38660784c9e01ad1eb810ecfc045b721bcd3c3
|
4
|
+
data.tar.gz: 43212277b0d8b7fec3551bf234ff31288eaf2f1fe63e494ed82ab7438d3a8c3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 230b47645cebcda1c1d56df140a8a1aced48807e0188270bbc25034c91ea3b612cbd004000bef00a7e81ca0de57b63463665d5679cb5de3ef14ed264ed971f46
|
7
|
+
data.tar.gz: 50f2cf4ca7215a501b9999601aec898b4c4006f468ceba9481b9ad5d7820481650dd21ddb68da3fe632571e4bde708a5d1877598b20ba484ceff72c768672247
|
@@ -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
|
@@ -73,9 +73,8 @@ module IsoDoc
|
|
73
73
|
|
74
74
|
def dt_parse(dterm, term)
|
75
75
|
if dterm.elements.empty?
|
76
|
-
# term.p **attr_code(class: note? ? "Note" : nil) do |p|
|
77
76
|
term.p do |p|
|
78
|
-
p
|
77
|
+
dterm.children.each { |n| parse(n, p) }
|
79
78
|
end
|
80
79
|
else
|
81
80
|
dterm.children.each { |n| parse(n, term) }
|
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.8
|
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-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html2doc
|