isodoc 2.1.2.1 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/class_utils.rb +16 -0
- data/lib/isodoc/function/utils.rb +4 -0
- data/lib/isodoc/presentation_function/block.rb +7 -3
- data/lib/isodoc/presentation_function/image.rb +1 -1
- data/lib/isodoc/presentation_function/inline.rb +0 -8
- data/lib/isodoc/presentation_function/section.rb +1 -1
- data/lib/isodoc/presentation_function/xrefs.rb +1 -3
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/inline.rb +7 -2
- data/lib/isodoc/xref.rb +1 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +1 -0
- data/lib/isodoc-yaml/i18n-de.yaml +1 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bf48bda8bc7d17d20a766f93c30bcf9f6e7e597497f8663f2c96ff292ada4f5
|
4
|
+
data.tar.gz: 7efd7f5c3aff9ee37fc631eecd1a564213ab56f92780807d1dff2b17e05c402b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 449d645dc7a4caaf2cd778dedfa4bb995344c3c83b076abbe4ea971b32d6fc9515ee7ae1140d76dfbc5f2c01220513979ea239c095fc2037b84263996a728e4f
|
7
|
+
data.tar.gz: 2031af0175ba1ba995fe3cca887180fa0e0d097dcfd6e2afb51eb7dc60ad8934bfbf4fc17dd9f91f1f2fba8e63e46efd8cee7a2fb2e9693d3f3f804ef432f662
|
data/lib/isodoc/class_utils.rb
CHANGED
@@ -62,5 +62,21 @@ module IsoDoc
|
|
62
62
|
end
|
63
63
|
xml.root.children.to_xml
|
64
64
|
end
|
65
|
+
|
66
|
+
def nearest_block_parent(node)
|
67
|
+
until %w(p title td th name formula li dt dd sourcecode pre quote
|
68
|
+
note example)
|
69
|
+
.include?(node.name)
|
70
|
+
node = node.parent
|
71
|
+
end
|
72
|
+
node
|
73
|
+
end
|
74
|
+
|
75
|
+
# node is at the start of sentence in a Metanorma XML context
|
76
|
+
def start_of_sentence(node)
|
77
|
+
prec = nearest_block_parent(node).xpath("./descendant-or-self::text()") &
|
78
|
+
node.xpath("./preceding::text()")
|
79
|
+
prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map(&:text).join)
|
80
|
+
end
|
65
81
|
end
|
66
82
|
end
|
@@ -11,6 +11,10 @@ module IsoDoc
|
|
11
11
|
self.class.ns(xpath)
|
12
12
|
end
|
13
13
|
|
14
|
+
def start_of_sentence(node)
|
15
|
+
self.class.start_of_sentence(node)
|
16
|
+
end
|
17
|
+
|
14
18
|
def insert_tab(out, count)
|
15
19
|
tab = %w(Hans Hant).include?(@script) ? " " : "  "
|
16
20
|
[1..count].each { out << tab }
|
@@ -8,6 +8,10 @@ module IsoDoc
|
|
8
8
|
text.capitalize
|
9
9
|
end
|
10
10
|
|
11
|
+
def block_delim
|
12
|
+
" — "
|
13
|
+
end
|
14
|
+
|
11
15
|
def prefix_name(node, delim, number, elem)
|
12
16
|
return if number.nil? || number.empty?
|
13
17
|
|
@@ -31,7 +35,7 @@ module IsoDoc
|
|
31
35
|
return if labelled_ancestor(elem)
|
32
36
|
|
33
37
|
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
34
|
-
prefix_name(elem,
|
38
|
+
prefix_name(elem, block_delim,
|
35
39
|
l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
|
36
40
|
end
|
37
41
|
|
@@ -60,7 +64,7 @@ module IsoDoc
|
|
60
64
|
else
|
61
65
|
l10n("#{@i18n.example} #{n[:label]}")
|
62
66
|
end
|
63
|
-
prefix_name(elem,
|
67
|
+
prefix_name(elem, block_delim, lbl, "name")
|
64
68
|
end
|
65
69
|
|
66
70
|
def note(docxml)
|
@@ -130,7 +134,7 @@ module IsoDoc
|
|
130
134
|
return if elem["unnumbered"] && !elem.at(ns("./name"))
|
131
135
|
|
132
136
|
n = @xrefs.anchor(elem["id"], :label, false)
|
133
|
-
prefix_name(elem,
|
137
|
+
prefix_name(elem, block_delim, l10n("#{lower2cap @i18n.table} #{n}"),
|
134
138
|
"name")
|
135
139
|
end
|
136
140
|
|
@@ -32,7 +32,7 @@ module IsoDoc
|
|
32
32
|
return if elem.at(ns("./figure")) && !elem.at(ns("./name"))
|
33
33
|
|
34
34
|
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
35
|
-
prefix_name(elem,
|
35
|
+
prefix_name(elem, block_delim,
|
36
36
|
l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
|
37
37
|
end
|
38
38
|
|
@@ -3,14 +3,6 @@ require_relative "xrefs"
|
|
3
3
|
|
4
4
|
module IsoDoc
|
5
5
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
6
|
-
def nearest_block_parent(node)
|
7
|
-
until %w(p title td th name formula li dt dd sourcecode pre)
|
8
|
-
.include?(node.name)
|
9
|
-
node = node.parent
|
10
|
-
end
|
11
|
-
node
|
12
|
-
end
|
13
|
-
|
14
6
|
def non_locality_elems(node)
|
15
7
|
node.children.reject do |c|
|
16
8
|
%w{locality localityStack location}.include? c.name
|
@@ -177,7 +177,7 @@ module IsoDoc
|
|
177
177
|
|
178
178
|
def toc(docxml)
|
179
179
|
docxml.xpath(ns("//toc//xref[text()]")).each do |x|
|
180
|
-
lbl = @xrefs.
|
180
|
+
lbl = @xrefs.anchor(x["target"], :label) or next
|
181
181
|
x.children.first.previous = "#{lbl}<tab/>"
|
182
182
|
end
|
183
183
|
end
|
@@ -105,9 +105,7 @@ module IsoDoc
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def capitalise_xref1(node, linkend)
|
108
|
-
|
109
|
-
node.xpath("./preceding::text()")
|
110
|
-
if prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map(&:text).join)
|
108
|
+
if start_of_sentence(node)
|
111
109
|
Common::case_with_markup(linkend, "capital", @script)
|
112
110
|
else linkend
|
113
111
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module WordFunction
|
3
3
|
module Body
|
4
|
-
def section_break(body)
|
4
|
+
def section_break(body, continuous: false)
|
5
5
|
body.p do |p|
|
6
|
-
|
6
|
+
if continuous
|
7
|
+
p.br **{ clear: "all", style: "page-break-before:auto;"\
|
8
|
+
"mso-break-type:section-break" }
|
9
|
+
else
|
10
|
+
p.br **{ clear: "all", class: "section" }
|
11
|
+
end
|
7
12
|
end
|
8
13
|
end
|
9
14
|
|
data/lib/isodoc/xref.rb
CHANGED
@@ -52,7 +52,7 @@ module IsoDoc
|
|
52
52
|
|
53
53
|
# extract names for all anchors, xref and label
|
54
54
|
def parse(docxml)
|
55
|
-
amend_preprocess(docxml) if
|
55
|
+
amend_preprocess(docxml) if @parse_settings.empty?
|
56
56
|
initial_anchor_names(docxml)
|
57
57
|
back_anchor_names(docxml)
|
58
58
|
# preempt clause notes with all other types of note (ISO default)
|
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.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|
@@ -504,7 +504,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
504
504
|
- !ruby/object:Gem::Version
|
505
505
|
version: '0'
|
506
506
|
requirements: []
|
507
|
-
rubygems_version: 3.3.
|
507
|
+
rubygems_version: 3.3.16
|
508
508
|
signing_key:
|
509
509
|
specification_version: 4
|
510
510
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|