isodoc 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/convert.rb +1 -1
- data/lib/isodoc/function/inline.rb +9 -27
- data/lib/isodoc/function/inline_simple.rb +25 -0
- data/lib/isodoc/function/setup.rb +1 -0
- data/lib/isodoc/init.rb +2 -1
- data/lib/isodoc/metadata.rb +4 -1
- data/lib/isodoc/metadata_contributor.rb +2 -2
- data/lib/isodoc/presentation_function/docid.rb +18 -10
- data/lib/isodoc/presentation_function/inline.rb +2 -0
- data/lib/isodoc/presentation_function/refs.rb +18 -17
- data/lib/isodoc/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_sect_gen.rb +0 -2
- 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: 66420421669f651f0c898afd16ed5ccdb1fbb4114531f72ed846d179ced88d9f
|
|
4
|
+
data.tar.gz: a2f42bfa3a386d66d78a360cb57a28e29cce05d70b8f18d84acdd995704b0090
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec7e84f1d6ab621b275c76e94781fc9b539bdd2e6656551efd617832de24a94f753aaaf1951a3a3fa7d42a983c5ced677e4fde1edf4477d029cafa0151a3185e
|
|
7
|
+
data.tar.gz: 9bb6ad10f0260df9f7994a94cfadd58a67cbc6b547ec17294ee09226e9a01997f9f9a2f1b744ae58338803947160155b15ca69d425848b35b6a88615ef5105fb
|
data/lib/isodoc/convert.rb
CHANGED
|
@@ -88,7 +88,7 @@ module IsoDoc
|
|
|
88
88
|
def bibrenderer(options = {})
|
|
89
89
|
::Relaton::Render::IsoDoc::General
|
|
90
90
|
.new(options.merge(language: @lang, script: @script,
|
|
91
|
-
i18nhash: @i18n.get))
|
|
91
|
+
i18nhash: @i18n.get, config: @relatonrenderconfig))
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def convert1_namespaces(html)
|
|
@@ -4,9 +4,9 @@ module IsoDoc
|
|
|
4
4
|
module Function
|
|
5
5
|
module Inline
|
|
6
6
|
def link_parse(node, out)
|
|
7
|
-
url = node
|
|
8
|
-
node["
|
|
9
|
-
|
|
7
|
+
url = link_parse_url(node)
|
|
8
|
+
out.a **attr_code(href: url, title: node["alt"],
|
|
9
|
+
class: node["style"]) do |l|
|
|
10
10
|
if node.elements.empty? && node.text.strip.empty?
|
|
11
11
|
l << @c.encode(node["target"].sub(/^mailto:/, ""), :basic,
|
|
12
12
|
:hexadecimal)
|
|
@@ -15,6 +15,12 @@ module IsoDoc
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
def link_parse_url(node)
|
|
19
|
+
url = node["target"]
|
|
20
|
+
node["update-type"] == "true" and url = suffix_url(url)
|
|
21
|
+
url
|
|
22
|
+
end
|
|
23
|
+
|
|
18
24
|
# Presentation XML classes which we need not pass on to HTML or DOC
|
|
19
25
|
SPAN_UNWRAP_CLASSES =
|
|
20
26
|
%w[fmt-caption-label fmt-label-delim fmt-caption-delim fmt-autonum-delim
|
|
@@ -213,30 +219,6 @@ module IsoDoc
|
|
|
213
219
|
children_parse(node, s)
|
|
214
220
|
end
|
|
215
221
|
end
|
|
216
|
-
|
|
217
|
-
def fmt_concept_parse(node, out)
|
|
218
|
-
children_parse(node, out)
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
def fmt_date_parse(node, out)
|
|
222
|
-
children_parse(node, out)
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
def fmt_fn_label_parse(node, out)
|
|
226
|
-
children_parse(node, out)
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
def fmt_footnote_container_parse(node, out)
|
|
230
|
-
children_parse(node, out)
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
def fmt_annotation_start_parse(node, out)
|
|
234
|
-
children_parse(node, out)
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
def fmt_annotation_end_parse(node, out)
|
|
238
|
-
children_parse(node, out)
|
|
239
|
-
end
|
|
240
222
|
end
|
|
241
223
|
end
|
|
242
224
|
end
|
|
@@ -98,6 +98,31 @@ module IsoDoc
|
|
|
98
98
|
def semx_sourcecode_parse(node, out); end
|
|
99
99
|
def annotation_note_parse(node, out); end
|
|
100
100
|
def semx_source_parse(node, out); end
|
|
101
|
+
|
|
102
|
+
def fmt_concept_parse(node, out)
|
|
103
|
+
children_parse(node, out)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def fmt_date_parse(node, out)
|
|
107
|
+
children_parse(node, out)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def fmt_fn_label_parse(node, out)
|
|
111
|
+
children_parse(node, out)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def fmt_footnote_container_parse(node, out)
|
|
115
|
+
children_parse(node, out)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def fmt_annotation_start_parse(node, out)
|
|
119
|
+
children_parse(node, out)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def fmt_annotation_end_parse(node, out)
|
|
123
|
+
children_parse(node, out)
|
|
124
|
+
end
|
|
125
|
+
|
|
101
126
|
end
|
|
102
127
|
end
|
|
103
128
|
end
|
data/lib/isodoc/init.rb
CHANGED
|
@@ -80,6 +80,7 @@ module IsoDoc
|
|
|
80
80
|
@script = options[:script] || "Latn"
|
|
81
81
|
@locale = options[:locale]
|
|
82
82
|
@localizenumber = options[:localizenumber]
|
|
83
|
+
@relatonrenderconfig = options[:relatonrenderconfig]
|
|
83
84
|
end
|
|
84
85
|
|
|
85
86
|
def init_locations(options)
|
|
@@ -186,7 +187,7 @@ module IsoDoc
|
|
|
186
187
|
def omit_docid_prefix(prefix)
|
|
187
188
|
prefix.nil? || prefix.empty? and return true
|
|
188
189
|
%w(ISO IEC IEV ITU W3C BIPM csd metanorma repository metanorma-ordinal
|
|
189
|
-
title).include? prefix
|
|
190
|
+
author-date title).include? prefix
|
|
190
191
|
end
|
|
191
192
|
|
|
192
193
|
def connectives_spans(text)
|
data/lib/isodoc/metadata.rb
CHANGED
|
@@ -9,7 +9,7 @@ module IsoDoc
|
|
|
9
9
|
Common::ns(xpath)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
def l10n(expr, lang = @lang, script = @script, opt = {})
|
|
13
13
|
opt[:locale] ||= @locale
|
|
14
14
|
@i18n.l10n(expr, lang, script, opt)
|
|
15
15
|
end
|
|
@@ -182,6 +182,9 @@ module IsoDoc
|
|
|
182
182
|
set(:title_footnote, ret)
|
|
183
183
|
end
|
|
184
184
|
|
|
185
|
+
def images(_isoxml, _out)
|
|
186
|
+
end
|
|
187
|
+
|
|
185
188
|
def code_css(isoxml, _out)
|
|
186
189
|
c = isoxml.at(ns("//metanorma-extension/source-highlighter-css")) or return
|
|
187
190
|
set(:code_css, c.text)
|
|
@@ -66,8 +66,8 @@ module IsoDoc
|
|
|
66
66
|
logos = []
|
|
67
67
|
agency_data(xml).each do |org|
|
|
68
68
|
agency1 = org[:abbr] || org[:name]
|
|
69
|
-
org[:name] and publisher << org[:name]
|
|
70
|
-
org[:logo] and logos << org[:logo]
|
|
69
|
+
org[:name] && !org[:name].empty? and publisher << org[:name]
|
|
70
|
+
org[:logo] && !org[:logo].empty? and logos << org[:logo]
|
|
71
71
|
agency = iso?(org) ? "ISO/#{agency}" : "#{agency}#{agency1}/"
|
|
72
72
|
end
|
|
73
73
|
[agency.sub(%r{/$}, ""), publisher, logos]
|
|
@@ -28,20 +28,21 @@ module IsoDoc
|
|
|
28
28
|
|
|
29
29
|
# returns [metanorma, non-metanorma, DOI/ISSN/ISBN] identifiers
|
|
30
30
|
def bibitem_ref_code(bib)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
bib["suppress_identifier"] == "true" and return [nil, nil, nil, nil]
|
|
31
|
+
ret = bibitem_ref_code_prep(bib)
|
|
32
|
+
ret.all?(&:nil?) or return ret
|
|
33
|
+
bib["suppress_identifier"] == "true" and return [nil, nil, nil, nil, nil]
|
|
34
34
|
# [nil, no_identifier(bib), nil, nil]
|
|
35
|
-
[nil, nil, nil, nil]
|
|
35
|
+
[nil, nil, nil, nil, nil]
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def bibitem_ref_code_prep(bib)
|
|
39
|
-
id = bib.at(ns("./docidentifier[@type = 'metanorma']"))
|
|
40
|
-
bib.at(ns("./docidentifier[@type = 'title']"))
|
|
39
|
+
id = bib.at(ns("./docidentifier[@type = 'metanorma']"))
|
|
41
40
|
id1 = pref_ref_code(bib)
|
|
42
|
-
id2 = bib.at(ns("./docidentifier[#{
|
|
41
|
+
id2 = bib.at(ns("./docidentifier[#{SERIAL_NUM_DOCID}]"))
|
|
43
42
|
id3 = bib.at(ns("./docidentifier[@type = 'metanorma-ordinal']"))
|
|
44
|
-
[
|
|
43
|
+
id4 = bib.at(ns("./docidentifier[@type = 'title']")) ||
|
|
44
|
+
bib.at(ns("./docidentifier[@type = 'author-date']"))
|
|
45
|
+
[id, id1, id2, id3, id4]
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
def no_identifier(bib)
|
|
@@ -64,6 +65,12 @@ module IsoDoc
|
|
|
64
65
|
num
|
|
65
66
|
end
|
|
66
67
|
|
|
68
|
+
def bracket(num)
|
|
69
|
+
num.nil? and return nil
|
|
70
|
+
num = xml_to_string_skip_fn(num).sub(/^\[/, "").sub(/\]$/, "")
|
|
71
|
+
"[#{num}]"
|
|
72
|
+
end
|
|
73
|
+
|
|
67
74
|
def unbracket1(ident)
|
|
68
75
|
ident.nil? and return nil
|
|
69
76
|
ident.is_a?(String) or ident = xml_to_string_skip_fn(ident)
|
|
@@ -78,10 +85,11 @@ module IsoDoc
|
|
|
78
85
|
end
|
|
79
86
|
|
|
80
87
|
def render_identifier(ident)
|
|
81
|
-
{ metanorma:
|
|
88
|
+
{ metanorma: bracket(ident[0]),
|
|
82
89
|
sdo: unbracket(ident[1]),
|
|
83
90
|
doi: unbracket(ident[2]),
|
|
84
|
-
ordinal:
|
|
91
|
+
ordinal: bracket(ident[3]),
|
|
92
|
+
content: unbracket(ident[4]) }
|
|
85
93
|
end
|
|
86
94
|
end
|
|
87
95
|
end
|
|
@@ -20,10 +20,10 @@ module IsoDoc
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def reference_name(ref)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
identifiers = render_identifier(bibitem_ref_code(ref))
|
|
24
|
+
reference = docid_l10n(identifiers[:content] || identifiers[:metanorma] ||
|
|
25
|
+
identifiers[:sdo] || identifiers[:ordinal] ||
|
|
26
|
+
identifiers[:doi])
|
|
27
27
|
@xrefs.get[ref["id"]] = { xref: esc(reference) }
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -164,31 +164,31 @@ module IsoDoc
|
|
|
164
164
|
datefn = date_note_process(bib)
|
|
165
165
|
ids = bibitem_ref_code(bib)
|
|
166
166
|
idents = render_identifier(ids)
|
|
167
|
-
ret = if biblio then biblio_ref_entry_code(ordinal, idents,
|
|
167
|
+
ret = if biblio then biblio_ref_entry_code(ordinal, idents,
|
|
168
168
|
standard, datefn, bib)
|
|
169
|
-
else norm_ref_entry_code(ordinal, idents,
|
|
170
|
-
bib)
|
|
169
|
+
else norm_ref_entry_code(ordinal, idents, standard, datefn, bib)
|
|
171
170
|
end
|
|
172
171
|
bib.add_first_child("<biblio-tag>#{@i18n.l10n(ret)}</biblio-tag>")
|
|
173
172
|
end
|
|
174
173
|
|
|
175
|
-
def norm_ref_entry_code(_ordinal,
|
|
176
|
-
ret = (
|
|
174
|
+
def norm_ref_entry_code(_ordinal, ids, _standard, datefn, _bib)
|
|
175
|
+
ret = (ids[:ordinal] || ids[:content] || ids[:metanorma] || ids[:sdo]).to_s
|
|
177
176
|
ret = esc(ret)
|
|
178
|
-
(
|
|
179
|
-
ret += ", #{esc
|
|
177
|
+
(ids[:ordinal] || ids[:metanorma]) && ids[:sdo] and
|
|
178
|
+
ret += ", #{esc ids[:sdo]}"
|
|
180
179
|
ret += datefn
|
|
181
180
|
ret.empty? and return ret
|
|
182
|
-
|
|
181
|
+
ids[:sdo] and ret += ","
|
|
183
182
|
ret.sub(",", "").strip.empty? and return ""
|
|
184
183
|
"#{ret} "
|
|
185
184
|
end
|
|
186
185
|
|
|
187
186
|
# if ids is just a number, only use that ([1] Non-Standard)
|
|
188
187
|
# else, use both ordinal, as prefix, and ids
|
|
189
|
-
def biblio_ref_entry_code(ordinal, ids,
|
|
188
|
+
def biblio_ref_entry_code(ordinal, ids, _standard, datefn, _bib)
|
|
190
189
|
# standard and id = nil
|
|
191
|
-
ret = esc(ids[:ordinal]) || esc(ids[:
|
|
190
|
+
ret = esc(ids[:ordinal]) || esc(ids[:content]) || esc(ids[:metanorma]) ||
|
|
191
|
+
"[#{esc ordinal.to_s}]"
|
|
192
192
|
if ids[:sdo] && !ids[:sdo].empty?
|
|
193
193
|
ret = prefix_bracketed_ref(ret)
|
|
194
194
|
ret += "#{esc ids[:sdo]}#{datefn}, "
|
|
@@ -223,15 +223,16 @@ module IsoDoc
|
|
|
223
223
|
bib["hidden"] == "true"
|
|
224
224
|
end
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
# DOI, ISSN, ISBN cover term
|
|
227
|
+
SERIAL_NUM_DOCID = <<~XPATH.strip.freeze
|
|
227
228
|
@type = 'DOI' or @type = 'doi' or @type = 'ISSN' or @type = 'issn' or @type = 'ISBN' or @type = 'isbn' or starts-with(@type, 'ISSN.') or starts-with(@type, 'ISBN.') or starts-with(@type, 'issn.') or starts-with(@type, 'isbn.')
|
|
228
229
|
XPATH
|
|
229
230
|
|
|
230
231
|
def standard?(bib)
|
|
231
232
|
ret = false
|
|
232
233
|
bib.xpath(ns("./docidentifier")).each do |id|
|
|
233
|
-
id["type"].nil? ||
|
|
234
|
-
|
|
234
|
+
id["type"].nil? || id.at(".//self::*[#{SERIAL_NUM_DOCID} or "\
|
|
235
|
+
"@type = 'metanorma']") and next
|
|
235
236
|
ret = true
|
|
236
237
|
end
|
|
237
238
|
ret
|
data/lib/isodoc/version.rb
CHANGED
|
@@ -162,7 +162,6 @@ module IsoDoc
|
|
|
162
162
|
xref = labelled_autonum(@labels["clause"], num)
|
|
163
163
|
label = num
|
|
164
164
|
c = clause_title(clause) and title = semx(clause, c, "title")
|
|
165
|
-
#clause["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
|
166
165
|
@anchors[clause["id"]] =
|
|
167
166
|
{ label:, xref:, title:, level:, type: "clause",
|
|
168
167
|
elem: @labels["clause"] }
|
|
@@ -184,7 +183,6 @@ module IsoDoc
|
|
|
184
183
|
level == 1 && clause.name == "annex" and
|
|
185
184
|
label = annex_name_lbl(clause, label)
|
|
186
185
|
c = clause_title(clause) and title = semx(clause, c, "title")
|
|
187
|
-
#clause["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
|
188
186
|
@anchors[clause["id"]] =
|
|
189
187
|
{ label:, xref: labelled_autonum(@labels["annex"], num), title:,
|
|
190
188
|
elem: @labels["annex"], type: "clause",
|
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: 3.4.
|
|
4
|
+
version: 3.4.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: 2025-
|
|
11
|
+
date: 2025-12-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|