isodoc 2.10.6 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +2 -1
- data/lib/isodoc/function/utils.rb +2 -3
- data/lib/isodoc/metadata.rb +10 -14
- data/lib/isodoc/metadata_contributor.rb +4 -9
- data/lib/isodoc/presentation_function/erefs.rb +4 -4
- data/lib/isodoc/presentation_function/image.rb +10 -7
- data/lib/isodoc/presentation_function/inline.rb +1 -0
- data/lib/isodoc/presentation_function/metadata.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_gen.rb +5 -4
- data/lib/isodoc/xref/xref_gen_seq.rb +4 -1
- data/lib/isodoc-yaml/i18n-ja.yaml +18 -18
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c38cf2267396e98d1de955feacbd9002b32d6f076593c414d8395eea21f08510
|
4
|
+
data.tar.gz: 433c3e2d54797e3f22eb693f714163f4c3ac523a7584730872e1f7316b2dec81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b36c7d9e7676ba7df00d34bb78797649b683a454776605249861978cf4ec5df3bdf61b7e4f05ec4e6644f62ac15aaa2e840cb5c36afb654e5c3d5457ddbd023e
|
7
|
+
data.tar.gz: bce31398c2b4b23f8e4b1a3192a73564f69ebfc0859320aff702c8eb3d2eadc9ae84e05275d6be1a54abb2a1be1146786925c2452a9e7ae8caac3d285f10beb6
|
data/isodoc.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
# spec.add_dependency "relaton-cli"
|
36
36
|
# spec.add_dependency "metanorma-utils", "~> 1.5.0" # already in isodoc-i18n
|
37
37
|
spec.add_dependency "mn2pdf"
|
38
|
-
spec.add_dependency "mn-requirements", "~> 0.
|
38
|
+
spec.add_dependency "mn-requirements", "~> 0.4.0"
|
39
39
|
|
40
40
|
spec.add_dependency "relaton-render", "~> 0.7.1"
|
41
41
|
spec.add_dependency "roman-numerals"
|
@@ -55,5 +55,6 @@ Gem::Specification.new do |spec|
|
|
55
55
|
spec.add_development_dependency "sassc", "~> 2.4.0"
|
56
56
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
57
57
|
spec.add_development_dependency "timecop", "~> 0.9"
|
58
|
+
spec.add_development_dependency "xml-c14n"
|
58
59
|
# spec.metadata["rubygems_mfa_required"] = "true"
|
59
60
|
end
|
@@ -213,10 +213,9 @@ module IsoDoc
|
|
213
213
|
%w(example requirement recommendation permission
|
214
214
|
note table figure sourcecode).freeze
|
215
215
|
|
216
|
-
def labelled_ancestor(elem)
|
217
|
-
#!elem.path.gsub(/\[\d+\]/, "").split(%r{/})[1..-1]
|
216
|
+
def labelled_ancestor(elem, exceptions = [])
|
218
217
|
!elem.ancestors.map(&:name)
|
219
|
-
.intersection(LABELLED_ANCESTOR_ELEMENTS).empty?
|
218
|
+
.intersection(LABELLED_ANCESTOR_ELEMENTS - exceptions).empty?
|
220
219
|
end
|
221
220
|
|
222
221
|
def emf?(type)
|
data/lib/isodoc/metadata.rb
CHANGED
@@ -14,7 +14,7 @@ module IsoDoc
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def initialize(lang, script, locale, i18n, fonts_options = {})
|
17
|
-
@metadata = { lang
|
17
|
+
@metadata = { lang:, script: }
|
18
18
|
DATETYPES.each { |w| @metadata["#{w.gsub('-', '_')}date".to_sym] = "XXX" }
|
19
19
|
@lang = lang
|
20
20
|
@script = script
|
@@ -29,10 +29,6 @@ module IsoDoc
|
|
29
29
|
@metadata
|
30
30
|
end
|
31
31
|
|
32
|
-
def labels
|
33
|
-
@labels
|
34
|
-
end
|
35
|
-
|
36
32
|
def set(key, value)
|
37
33
|
@metadata[key] = value
|
38
34
|
end
|
@@ -44,12 +40,12 @@ module IsoDoc
|
|
44
40
|
end
|
45
41
|
|
46
42
|
def doctype(isoxml, _out)
|
47
|
-
b = isoxml
|
48
|
-
set(:doctype, status_print(b))
|
49
|
-
b1 = isoxml
|
50
|
-
set(:doctype_display, status_print(b1))
|
51
|
-
b = isoxml
|
52
|
-
set(:subdoctype, status_print(b))
|
43
|
+
b = isoxml.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return
|
44
|
+
set(:doctype, status_print(b.text))
|
45
|
+
b1 = isoxml.at(ns("//bibdata/ext/doctype#{currlang}")) || b
|
46
|
+
set(:doctype_display, status_print(b1.text))
|
47
|
+
b = isoxml.at(ns("//bibdata/ext/subdoctype#{NOLANG}")) || return
|
48
|
+
set(:subdoctype, status_print(b.text))
|
53
49
|
end
|
54
50
|
|
55
51
|
def docstatus(xml, _out)
|
@@ -59,11 +55,11 @@ module IsoDoc
|
|
59
55
|
s1 = xml.at(ns("//bibdata/status/stage#{currlang}")) || s
|
60
56
|
set(:stage, status_print(s.text))
|
61
57
|
s1 and set(:stage_display, status_print(s1.text))
|
62
|
-
(i = xml
|
58
|
+
(i = xml.at(ns("//bibdata/status/substage#{NOLANG}"))&.text) and
|
63
59
|
set(:substage, i)
|
64
|
-
(i1 = xml
|
60
|
+
(i1 = xml.at(ns("//bibdata/status/substage#{currlang}"))&.text || i) and
|
65
61
|
set(:substage_display, i1)
|
66
|
-
(i2 = xml
|
62
|
+
(i2 = xml.at(ns("//bibdata/status/iteration"))&.text) and
|
67
63
|
set(:iteration, i2)
|
68
64
|
set(:unpublished, unpublished(s.text))
|
69
65
|
unpublished(s.text) && set(:stageabbr, stage_abbr(s.text))
|
@@ -67,20 +67,15 @@ module IsoDoc
|
|
67
67
|
publisher = []
|
68
68
|
xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = 'publisher']/" \
|
69
69
|
"organization")).each do |org|
|
70
|
-
name =
|
71
|
-
|
72
|
-
|
70
|
+
name = org.at(ns("./name[@language = '#{@lang}']")) ||
|
71
|
+
org.at(ns("./name"))
|
72
|
+
agency1 = org.at(ns("./abbreviation"))&.text || name&.text
|
73
|
+
publisher << name.text if name
|
73
74
|
agency = iso?(org) ? "ISO/#{agency}" : "#{agency}#{agency1}/"
|
74
75
|
end
|
75
76
|
[agency, publisher]
|
76
77
|
end
|
77
78
|
|
78
|
-
def extract_variant(node)
|
79
|
-
node.nil? and return node
|
80
|
-
x = node.at(ns("./variant[@language = '#{@lang}']")) and node = x
|
81
|
-
node.text
|
82
|
-
end
|
83
|
-
|
84
79
|
def agency(xml)
|
85
80
|
agency, publisher = agency1(xml)
|
86
81
|
set(:agency, agency.sub(%r{/$}, ""))
|
@@ -38,9 +38,9 @@ module IsoDoc
|
|
38
38
|
ret = resolve_eref_connectives(eref_locality_stacks(refs, target,
|
39
39
|
node))
|
40
40
|
node.delete("droploc") unless droploc
|
41
|
-
eref_localities1({ target
|
41
|
+
eref_localities1({ target:, number: "pl",
|
42
42
|
type: refs.first.at(ns("./locality/@type")).text,
|
43
|
-
from: l10n(ret[1..-1].join), node
|
43
|
+
from: l10n(ret[1..-1].join), node:, lang: @lang })
|
44
44
|
end
|
45
45
|
|
46
46
|
def can_conflate_eref_rendering?(refs)
|
@@ -143,9 +143,9 @@ module IsoDoc
|
|
143
143
|
def eref_localities0(ref, _idx, target, node)
|
144
144
|
if ref["type"] == "whole" then @i18n.wholeoftext
|
145
145
|
else
|
146
|
-
eref_localities1({ target
|
146
|
+
eref_localities1({ target:, type: ref["type"], number: "sg",
|
147
147
|
from: ref.at(ns("./referenceFrom"))&.text,
|
148
|
-
upto: ref.at(ns("./referenceTo"))&.text, node
|
148
|
+
upto: ref.at(ns("./referenceTo"))&.text, node:,
|
149
149
|
lang: @lang })
|
150
150
|
end
|
151
151
|
end
|
@@ -38,23 +38,26 @@ module IsoDoc
|
|
38
38
|
|
39
39
|
svg = Base64.strict_decode64(elem["src"]
|
40
40
|
.sub(%r{^data:image/svg\+xml;(charset=[^;]+;)?base64,}, ""))
|
41
|
-
x = Nokogiri::XML.fragment(svg.sub(/<\?xml[^>]*>/, ""))
|
42
|
-
config.huge
|
43
|
-
end
|
41
|
+
x = Nokogiri::XML.fragment(svg.sub(/<\?xml[^>]*>/, ""), &:huge)
|
44
42
|
elem["src"] = ""
|
45
43
|
elem.children = x
|
46
44
|
end
|
47
45
|
|
48
46
|
def figure1(elem)
|
49
|
-
|
50
|
-
elem
|
51
|
-
|
52
|
-
|
47
|
+
elem["class"] == "pseudocode" || elem["type"] == "pseudocode" and
|
48
|
+
return sourcecode1(elem)
|
49
|
+
figure_label?(elem) or return nil
|
53
50
|
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
51
|
+
# no xref, no label: this can be set in xref
|
54
52
|
prefix_name(elem, block_delim,
|
55
53
|
l10n("#{figure_label(elem)} #{lbl}"), "name")
|
56
54
|
end
|
57
55
|
|
56
|
+
def figure_label?(elem)
|
57
|
+
elem.at(ns("./figure")) && !elem.at(ns("./name")) and return false
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
58
61
|
def figure_label(elem)
|
59
62
|
klass = elem["class"] || "figure"
|
60
63
|
klasslbl = @i18n.get[klass] || klass
|
@@ -22,7 +22,7 @@ module IsoDoc
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def save_attachment(attachment, dir)
|
25
|
-
n = File.join(dir, attachment["name"])
|
25
|
+
n = File.join(dir, File.basename(attachment["name"]))
|
26
26
|
c = attachment.text.sub(%r{^data:[^;]+;(?:charset=[^;]+;)?base64,}, "")
|
27
27
|
File.open(n, "wb") { |f| f.write(Base64.strict_decode64(c)) }
|
28
28
|
end
|
data/lib/isodoc/version.rb
CHANGED
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -137,15 +137,16 @@ module IsoDoc
|
|
137
137
|
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
|
138
138
|
list.xpath(ns("./li")).each do |li|
|
139
139
|
bare_label, label =
|
140
|
-
list_item_value(li, c, depth, { list_anchor
|
140
|
+
list_item_value(li, c, depth, { list_anchor:, prev_label:,
|
141
141
|
refer_list: depth == 1 ? refer_list : nil })
|
142
142
|
li["id"] and @anchors[li["id"]] =
|
143
143
|
{ label: bare_label, bare_xref: "#{label})",
|
144
144
|
xref: "#{label})",
|
145
|
-
type: "listitem", refer_list
|
145
|
+
type: "listitem", refer_list:,
|
146
146
|
container: list_anchor[:container] }
|
147
147
|
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
148
|
-
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
148
|
+
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
149
|
+
refer_list)
|
149
150
|
end
|
150
151
|
end
|
151
152
|
end
|
@@ -227,7 +228,7 @@ module IsoDoc
|
|
227
228
|
def bookmark_anchor_names(xml)
|
228
229
|
xml.xpath(ns(".//bookmark")).noblank.each do |n|
|
229
230
|
_parent, id = id_ancestor(n)
|
230
|
-
#container = bookmark_container(parent)
|
231
|
+
# container = bookmark_container(parent)
|
231
232
|
@anchors[n["id"]] = { type: "bookmark", label: nil, value: nil,
|
232
233
|
xref: @anchors.dig(id, :xref) || "???",
|
233
234
|
container: @anchors.dig(id, :container) }
|
@@ -28,6 +28,7 @@ module IsoDoc
|
|
28
28
|
c = Counter.new
|
29
29
|
j = 0
|
30
30
|
clause.xpath(ns(self.class::FIGURE_NO_CLASS)).noblank.each do |t|
|
31
|
+
# labelled_ancestor(t, %w(figure)) and next # disable nested figure labelling
|
31
32
|
j = subfigure_increment(j, c, t)
|
32
33
|
sequential_figure_body(j, c, t, "figure", container:)
|
33
34
|
end
|
@@ -40,6 +41,7 @@ module IsoDoc
|
|
40
41
|
clause.xpath(ns(".//figure[@class][not(@class = 'pseudocode')]"))
|
41
42
|
.each do |t|
|
42
43
|
c[t["class"]] ||= Counter.new
|
44
|
+
# labelled_ancestor(t, %w(figure)) and next
|
43
45
|
j = subfigure_increment(j, c[t["class"]], t)
|
44
46
|
sequential_figure_body(j, c[t["class"]], t, t["class"],
|
45
47
|
container:)
|
@@ -157,7 +159,7 @@ container: false)
|
|
157
159
|
c = Counter.new
|
158
160
|
j = 0
|
159
161
|
clause.xpath(ns(self.class::FIGURE_NO_CLASS)).noblank.each do |t|
|
160
|
-
#
|
162
|
+
# labelled_ancestor(t, %w(figure)) and next
|
161
163
|
j = subfigure_increment(j, c, t)
|
162
164
|
hierarchical_figure_body(num, j, c, t, "figure")
|
163
165
|
end
|
@@ -169,6 +171,7 @@ container: false)
|
|
169
171
|
j = 0
|
170
172
|
clause.xpath(ns(".//figure[@class][not(@class = 'pseudocode')]"))
|
171
173
|
.noblank.each do |t|
|
174
|
+
# labelled_ancestor(t, %w(figure)) and next
|
172
175
|
c[t["class"]] ||= Counter.new
|
173
176
|
j = subfigure_increment(j, c[t["class"]], t)
|
174
177
|
hierarchical_figure_body(num, j, c[t["class"]], t, t["class"])
|
@@ -52,28 +52,28 @@ note: 注記
|
|
52
52
|
note_xref: 注記
|
53
53
|
termnote: 注釈%
|
54
54
|
list: リスト
|
55
|
-
deflist:
|
55
|
+
deflist: 定義リスト
|
56
56
|
figure: 図
|
57
57
|
diagram: Diagram
|
58
58
|
formula: 式
|
59
|
-
inequality:
|
59
|
+
inequality: 式
|
60
60
|
table: 表
|
61
|
-
requirement:
|
62
|
-
recommendation:
|
63
|
-
permission:
|
61
|
+
requirement: 要求
|
62
|
+
recommendation: 推奨
|
63
|
+
permission: 許可
|
64
64
|
box: Box
|
65
65
|
index: 索引
|
66
66
|
standard_no: 規格番号
|
67
67
|
number: 番号
|
68
68
|
# Modspec
|
69
|
-
recommendationtest:
|
70
|
-
requirementtest:
|
71
|
-
permissiontest:
|
72
|
-
recommendationclass:
|
73
|
-
requirementclass:
|
74
|
-
permissionclass:
|
75
|
-
abstracttest:
|
76
|
-
conformanceclass:
|
69
|
+
recommendationtest: 推奨テスト
|
70
|
+
requirementtest: 要件テスト
|
71
|
+
permissiontest: 許可テスト
|
72
|
+
recommendationclass: 推奨群
|
73
|
+
requirementclass: 要件群
|
74
|
+
permissionclass: 許可群
|
75
|
+
abstracttest: 抽象テスト
|
76
|
+
conformanceclass: 適合性テスト群
|
77
77
|
key: 記号説明
|
78
78
|
example: 例
|
79
79
|
example_xref: 例
|
@@ -110,12 +110,12 @@ month_november: November
|
|
110
110
|
month_december: December
|
111
111
|
obligation: Obligation
|
112
112
|
admonition: {
|
113
|
-
danger:
|
113
|
+
danger: 危険です,
|
114
114
|
warning: 警告,
|
115
|
-
caution:
|
116
|
-
important:
|
117
|
-
safety precautions:
|
118
|
-
editorial:
|
115
|
+
caution: 注意,
|
116
|
+
important: 重要,
|
117
|
+
safety precautions: 安全上の注意,
|
118
|
+
editorial: 編集者注
|
119
119
|
}
|
120
120
|
locality: {
|
121
121
|
section: Section,
|
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.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.4.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.4.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: relaton-render
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,6 +318,20 @@ dependencies:
|
|
318
318
|
- - "~>"
|
319
319
|
- !ruby/object:Gem::Version
|
320
320
|
version: '0.9'
|
321
|
+
- !ruby/object:Gem::Dependency
|
322
|
+
name: xml-c14n
|
323
|
+
requirement: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - ">="
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '0'
|
328
|
+
type: :development
|
329
|
+
prerelease: false
|
330
|
+
version_requirements: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - ">="
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '0'
|
321
335
|
description: |
|
322
336
|
isodoc converts documents in the IsoDoc document model into
|
323
337
|
Microsoft Word and HTML.
|