metanorma-bipm 2.0.7 → 2.1.1
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/bipm/base_convert.rb +9 -2
- data/lib/isodoc/bipm/bipm.brochure.xsl +1654 -476
- data/lib/isodoc/bipm/bipm.guide.xsl +1654 -476
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +1654 -476
- data/lib/isodoc/bipm/bipm.rapport.xsl +1654 -476
- data/lib/isodoc/bipm/doccontrol.rb +101 -0
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +1 -0
- data/lib/isodoc/bipm/init.rb +1 -1
- data/lib/isodoc/bipm/jcgm.standard.xsl +1615 -370
- data/lib/isodoc/bipm/presentation_xml_convert.rb +18 -93
- data/lib/isodoc/bipm/xref.rb +8 -4
- data/lib/metanorma/bipm/biblio.rng +62 -10
- data/lib/metanorma/bipm/converter.rb +38 -108
- data/lib/metanorma/bipm/front.rb +113 -0
- data/lib/metanorma/bipm/isodoc.rng +56 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +8 -6
@@ -3,6 +3,7 @@ require "metanorma-generic"
|
|
3
3
|
require "metanorma-iso"
|
4
4
|
require_relative "init"
|
5
5
|
require_relative "index"
|
6
|
+
require_relative "doccontrol"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
module BIPM
|
@@ -85,99 +86,6 @@ module IsoDoc
|
|
85
86
|
doccontrol docxml
|
86
87
|
end
|
87
88
|
|
88
|
-
def doccontrol(doc)
|
89
|
-
return unless doc.at(ns("//bibdata/relation[@type = 'supersedes']"))
|
90
|
-
|
91
|
-
clause = <<~DOCCONTROL
|
92
|
-
<doccontrol>
|
93
|
-
<title>Document Control</title>
|
94
|
-
<table unnumbered="true"><tbody>
|
95
|
-
<tr><th>Authors:</th><td/><td>#{list_authors(doc)}</td></tr>
|
96
|
-
#{doccontrol_row1(doc)} #{doccontrol_row2(doc)} #{list_drafts(doc)}
|
97
|
-
</tbody></table></doccontrol>
|
98
|
-
DOCCONTROL
|
99
|
-
doc.root << clause
|
100
|
-
end
|
101
|
-
|
102
|
-
def doccontrol_row1(doc)
|
103
|
-
return "" if list_draft(doc, 1) == ["", ""] && list_cochairs(doc).empty?
|
104
|
-
|
105
|
-
<<~ROW
|
106
|
-
<tr>#{list_draft(doc, 1)&.map { |x| "<td>#{x}</td>" }&.join}
|
107
|
-
<td>#{list_cochairs(doc)}</td></tr>
|
108
|
-
ROW
|
109
|
-
end
|
110
|
-
|
111
|
-
def doccontrol_row2(docxml)
|
112
|
-
list_draft(docxml, 2) == ["", ""] && list_chairs(docxml).empty? and
|
113
|
-
return ""
|
114
|
-
|
115
|
-
<<~ROW
|
116
|
-
<tr>#{list_draft(docxml, 2)&.map { |x| "<td>#{x}</td>" }&.join}
|
117
|
-
<td>#{list_chairs(docxml)}</td></tr>
|
118
|
-
ROW
|
119
|
-
end
|
120
|
-
|
121
|
-
def list_drafts(xml)
|
122
|
-
ret = ""
|
123
|
-
i = 3
|
124
|
-
while list_draft(xml, i) != ["", ""]
|
125
|
-
ret += "<tr>#{list_draft(xml, i).map { |x| "<td>#{x}</td>" }.join} "\
|
126
|
-
"<td/></tr>"
|
127
|
-
i += 1
|
128
|
-
end
|
129
|
-
ret
|
130
|
-
end
|
131
|
-
|
132
|
-
def list_draft(xml, idx)
|
133
|
-
d = xml.at(ns("//bibdata/relation[@type = 'supersedes'][#{idx}]"\
|
134
|
-
"/bibitem")) or return ["", ""]
|
135
|
-
|
136
|
-
draft = d&.at(ns("./version/draft"))&.text and draft = "Draft #{draft}"
|
137
|
-
edn = d&.at(ns("./edition"))&.text and edn = "Version #{edn}"
|
138
|
-
[[draft, edn].join(" "), d&.at(ns("./date"))&.text]
|
139
|
-
end
|
140
|
-
|
141
|
-
def list_authors(xml)
|
142
|
-
ret = list_people(
|
143
|
-
xml, "//bibdata/contributor[xmlns:role/@type = 'author']/person"
|
144
|
-
)
|
145
|
-
@i18n.boolean_conj(ret, "and")
|
146
|
-
end
|
147
|
-
|
148
|
-
COCHAIR = "xmlns:role[contains(text(),'co-chair')]".freeze
|
149
|
-
CHAIR = "[xmlns:role[contains(text(),'chair')]"\
|
150
|
-
"[not(contains(text(),'co-chair'))]]".freeze
|
151
|
-
|
152
|
-
def list_cochairs(xml)
|
153
|
-
ret = list_people(xml, "//bibdata/contributor[#{COCHAIR}]/person")
|
154
|
-
ret.empty? and return ""
|
155
|
-
role = xml&.at(ns("//bibdata/contributor[#{COCHAIR}]/role"))&.text
|
156
|
-
label = ret.size > 1 && role ? "#{role}s" : role
|
157
|
-
"#{label}: #{@i18n.boolean_conj(ret, 'and')}"
|
158
|
-
end
|
159
|
-
|
160
|
-
def list_chairs(xml)
|
161
|
-
ret = list_people(xml, "//bibdata/contributor#{CHAIR}/person")
|
162
|
-
ret.empty? and return ""
|
163
|
-
role = xml&.at(ns("//bibdata/contributor#{CHAIR}/role"))&.text
|
164
|
-
label = ret.size > 1 && role ? "#{role}s" : role
|
165
|
-
"#{label}: #{@i18n.boolean_conj(ret, 'and')}"
|
166
|
-
end
|
167
|
-
|
168
|
-
def list_people(xml, xpath)
|
169
|
-
ret = []
|
170
|
-
xml.xpath(ns(xpath)).each do |p|
|
171
|
-
name = p&.at(ns("./name/completename"))&.text
|
172
|
-
aff = p&.at(ns("./affiliation/organization/abbreviation"))&.text ||
|
173
|
-
p&.at(ns("./affiliation/organization/name"))&.text
|
174
|
-
c = name || ""
|
175
|
-
aff and c += " (#{aff})"
|
176
|
-
ret << c
|
177
|
-
end
|
178
|
-
ret
|
179
|
-
end
|
180
|
-
|
181
89
|
def twitter_cldr_localiser_symbols
|
182
90
|
{ group: " ", fraction_group: " ", fraction_group_digits: 3 }
|
183
91
|
end
|
@@ -261,6 +169,23 @@ module IsoDoc
|
|
261
169
|
super || @xrefs.klass.standard?(bibitem)
|
262
170
|
end
|
263
171
|
|
172
|
+
def expand_citeas(text)
|
173
|
+
ret = super
|
174
|
+
if @lang == "fr" && /^(CGPM|CIPM) /.match?(ret)
|
175
|
+
ret.sub!(/^(CGPM|CIPM) (\S+)/) do |_m|
|
176
|
+
"#{$1} – #{FR_OUTCOME_TYPE[$2.to_sym] || $2}"
|
177
|
+
end
|
178
|
+
end
|
179
|
+
ret
|
180
|
+
end
|
181
|
+
|
182
|
+
FR_OUTCOME_TYPE = {
|
183
|
+
Resolution: "Résolution",
|
184
|
+
Decision: "Décision",
|
185
|
+
Recommendation: "Recommandation",
|
186
|
+
Declaration: "Déclaration",
|
187
|
+
}.freeze
|
188
|
+
|
264
189
|
include Init
|
265
190
|
end
|
266
191
|
end
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -153,8 +153,9 @@ module IsoDoc
|
|
153
153
|
|
154
154
|
def annex_names(clause, num)
|
155
155
|
@anchors[clause["id"]] = annex_name_anchors(clause, num)
|
156
|
-
if
|
157
|
-
annex_names1(
|
156
|
+
if @klass.single_term_clause?(clause)
|
157
|
+
annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
|
158
|
+
num.to_s, 1)
|
158
159
|
else
|
159
160
|
i = Counter.new
|
160
161
|
prefix = @jcgm ? "" : "A"
|
@@ -176,8 +177,9 @@ module IsoDoc
|
|
176
177
|
def unnumbered_annex_names(clause)
|
177
178
|
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
178
179
|
@anchors[clause["id"]] = unnumbered_annex_anchors(lbl)
|
179
|
-
if
|
180
|
-
annex_names1(
|
180
|
+
if @klass.single_term_clause?(clause)
|
181
|
+
annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
|
182
|
+
num.to_s, 1)
|
181
183
|
else
|
182
184
|
clause.xpath(ns(SUBCLAUSES))
|
183
185
|
.each { |c| unnumbered_annex_names1(c, 2) }
|
@@ -229,10 +231,12 @@ module IsoDoc
|
|
229
231
|
|
230
232
|
def initial_anchor_names(doc)
|
231
233
|
super
|
234
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
232
235
|
if @jcgm
|
233
236
|
@iso.introduction_names(doc.at(ns("//introduction")))
|
234
237
|
@anchors.merge!(@iso.get)
|
235
238
|
end
|
239
|
+
end
|
236
240
|
end
|
237
241
|
|
238
242
|
def sequential_figure_names(clause)
|
@@ -527,7 +527,7 @@
|
|
527
527
|
</define>
|
528
528
|
<define name="LocalityType">
|
529
529
|
<data type="string">
|
530
|
-
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
530
|
+
<param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
531
531
|
</data>
|
532
532
|
</define>
|
533
533
|
<define name="referenceFrom">
|
@@ -677,6 +677,9 @@
|
|
677
677
|
<zeroOrMore>
|
678
678
|
<ref name="extent"/>
|
679
679
|
</zeroOrMore>
|
680
|
+
<optional>
|
681
|
+
<ref name="bibliographic_size"/>
|
682
|
+
</optional>
|
680
683
|
<zeroOrMore>
|
681
684
|
<ref name="accesslocation"/>
|
682
685
|
</zeroOrMore>
|
@@ -848,17 +851,46 @@
|
|
848
851
|
</define>
|
849
852
|
<define name="bplace">
|
850
853
|
<element name="place">
|
851
|
-
<
|
852
|
-
<
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<group>
|
857
|
+
<ref name="bibliocity"/>
|
858
|
+
<zeroOrMore>
|
859
|
+
<ref name="biblioregion"/>
|
860
|
+
</zeroOrMore>
|
861
|
+
<zeroOrMore>
|
862
|
+
<ref name="bibliocountry"/>
|
863
|
+
</zeroOrMore>
|
864
|
+
</group>
|
865
|
+
</choice>
|
866
|
+
</element>
|
867
|
+
</define>
|
868
|
+
<define name="bibliocity">
|
869
|
+
<element name="city">
|
859
870
|
<text/>
|
860
871
|
</element>
|
861
872
|
</define>
|
873
|
+
<define name="biblioregion">
|
874
|
+
<element name="region">
|
875
|
+
<ref name="RegionType"/>
|
876
|
+
</element>
|
877
|
+
</define>
|
878
|
+
<define name="bibliocountry">
|
879
|
+
<element name="country">
|
880
|
+
<ref name="RegionType"/>
|
881
|
+
</element>
|
882
|
+
</define>
|
883
|
+
<define name="RegionType">
|
884
|
+
<optional>
|
885
|
+
<attribute name="iso"/>
|
886
|
+
</optional>
|
887
|
+
<optional>
|
888
|
+
<attribute name="recommended">
|
889
|
+
<data type="boolean"/>
|
890
|
+
</attribute>
|
891
|
+
</optional>
|
892
|
+
<text/>
|
893
|
+
</define>
|
862
894
|
<define name="bprice">
|
863
895
|
<element name="price">
|
864
896
|
<attribute name="currency"/>
|
@@ -922,9 +954,29 @@
|
|
922
954
|
<text/>
|
923
955
|
</element>
|
924
956
|
</define>
|
957
|
+
<define name="sizevalue">
|
958
|
+
<element name="value">
|
959
|
+
<attribute name="type"/>
|
960
|
+
<text/>
|
961
|
+
</element>
|
962
|
+
</define>
|
963
|
+
<define name="bibliographic_size">
|
964
|
+
<element name="size">
|
965
|
+
<oneOrMore>
|
966
|
+
<ref name="sizevalue"/>
|
967
|
+
</oneOrMore>
|
968
|
+
</element>
|
969
|
+
</define>
|
925
970
|
<define name="extent">
|
926
971
|
<element name="extent">
|
927
|
-
<
|
972
|
+
<choice>
|
973
|
+
<zeroOrMore>
|
974
|
+
<ref name="locality"/>
|
975
|
+
</zeroOrMore>
|
976
|
+
<zeroOrMore>
|
977
|
+
<ref name="localityStack"/>
|
978
|
+
</zeroOrMore>
|
979
|
+
</choice>
|
928
980
|
</element>
|
929
981
|
</define>
|
930
982
|
<define name="series">
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "metanorma/standoc/converter"
|
2
2
|
require "metanorma/generic/converter"
|
3
|
+
require_relative "front"
|
3
4
|
|
4
5
|
module Metanorma
|
5
6
|
module BIPM
|
@@ -22,114 +23,6 @@ module Metanorma
|
|
22
23
|
{ org_name_long => configuration.organization_name_short }
|
23
24
|
end
|
24
25
|
|
25
|
-
def metadata_committee(node, xml)
|
26
|
-
return unless node.attr("committee-en") || node.attr("committee-fr")
|
27
|
-
|
28
|
-
xml.editorialgroup do |a|
|
29
|
-
metadata_committee1(node, a)
|
30
|
-
i = 2
|
31
|
-
while node.attr("committee-en_#{i}") || node.attr("committee-fr_#{i}")
|
32
|
-
metadata_committee2(node, a, i)
|
33
|
-
i += 1
|
34
|
-
end
|
35
|
-
metadata_workgroup(node, a)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def metadata_committee1(node, xml)
|
40
|
-
xml.committee **attr_code(acronym:
|
41
|
-
node.attr("committee-acronym")) do |c|
|
42
|
-
e = node.attr("committee-en") and
|
43
|
-
c.variant e, language: "en", script: "Latn"
|
44
|
-
e = node.attr("committee-fr") and
|
45
|
-
c.variant e, language: "fr", script: "Latn"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def metadata_committee2(node, xml, num)
|
50
|
-
xml.committee **attr_code(acronym:
|
51
|
-
node.attr("committee-acronym_#{num}")) do |c|
|
52
|
-
%w(en fr).each do |lg|
|
53
|
-
e = node.attr("committee-#{lg}_#{num}") and
|
54
|
-
c.variant e, language: lg, script: "Latn"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def metadata_workgroup(node, xml)
|
60
|
-
xml.workgroup(node.attr("workgroup"),
|
61
|
-
**attr_code(acronym: node.attr("workgroup-acronym")))
|
62
|
-
i = 2
|
63
|
-
while node.attr("workgroup_#{i}")
|
64
|
-
xml.workgroup(
|
65
|
-
node.attr("workgroup_#{i}"),
|
66
|
-
**attr_code(acronym: node.attr("workgroup-acronym_#{i}"))
|
67
|
-
)
|
68
|
-
i += 1
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def metadata_relations(node, xml)
|
73
|
-
super
|
74
|
-
relation_supersedes_self(node, xml, "")
|
75
|
-
i = 2
|
76
|
-
while relation_supersedes_self(node, xml, "_#{i}")
|
77
|
-
i += 1
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def relation_supersedes_self(node, xml, suffix)
|
82
|
-
d = node.attr("supersedes-date#{suffix}")
|
83
|
-
draft = node.attr("supersedes-draft#{suffix}")
|
84
|
-
edition = node.attr("supersedes-edition#{suffix}")
|
85
|
-
return false unless d || draft || edition
|
86
|
-
|
87
|
-
relation_supersedes_self1(xml, d, edition, draft)
|
88
|
-
end
|
89
|
-
|
90
|
-
def relation_supersedes_self1(xml, date, edition, draft)
|
91
|
-
xml.relation **{ type: "supersedes" } do |r|
|
92
|
-
r.bibitem do |b|
|
93
|
-
date and b.date(date,
|
94
|
-
**{ type: edition ? "published" : "circulated" })
|
95
|
-
edition and b.edition edition
|
96
|
-
draft and b.version do |v|
|
97
|
-
v.draft draft
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def personal_role(node, xml, suffix)
|
104
|
-
role = node.attr("role#{suffix}") || "author"
|
105
|
-
unless %w(author editor).include?(role.downcase)
|
106
|
-
desc = role
|
107
|
-
role = "editor"
|
108
|
-
end
|
109
|
-
xml.role desc, **{ type: role.downcase }
|
110
|
-
end
|
111
|
-
|
112
|
-
def title(node, xml)
|
113
|
-
["en", "fr"].each do |lang|
|
114
|
-
at = { language: lang, format: "text/plain" }
|
115
|
-
xml.title **attr_code(at.merge(type: "main")) do |t1|
|
116
|
-
t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-#{lang}"))
|
117
|
-
end
|
118
|
-
%w(cover appendix annex part subpart provenance).each do |w|
|
119
|
-
typed_title(node, xml, lang, w)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def typed_title(node, xml, lang, type)
|
125
|
-
at = { language: lang, format: "text/plain" }
|
126
|
-
return unless title = node.attr("title-#{type}-#{lang}")
|
127
|
-
|
128
|
-
xml.title **attr_code(at.merge(type: type)) do |t1|
|
129
|
-
t1 << Metanorma::Utils::asciidoc_sub(title)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
26
|
def sectiontype_streamline(ret)
|
134
27
|
case ret
|
135
28
|
when "introduction" then @jcgm ? "introduction" : "clause"
|
@@ -157,6 +50,43 @@ module Metanorma
|
|
157
50
|
ret
|
158
51
|
end
|
159
52
|
|
53
|
+
def reference_names(xmldoc)
|
54
|
+
xmldoc.xpath("//bibitem[not(ancestor::bibitem)]").each do |ref|
|
55
|
+
docid = ref.at("./docidentifier[@type = 'metanorma']") ||
|
56
|
+
ref.at("./docidentifier[not(@type = 'DOI')]") or next
|
57
|
+
date = ref.at("./date[@type = 'published']")
|
58
|
+
reference = format_ref(reference_names1(docid, date, docid["type"]),
|
59
|
+
docid["type"])
|
60
|
+
@anchors[ref["id"]] = { xref: reference }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def reference_names1(docid, date, type)
|
65
|
+
ret = docid.children.to_xml
|
66
|
+
if type == "BIPM" && date &&
|
67
|
+
/(CIPM|CGPM) (Decision|Resolution)/.match?(docid)
|
68
|
+
ret += " (#{date_range(date)})"
|
69
|
+
end
|
70
|
+
ret
|
71
|
+
end
|
72
|
+
|
73
|
+
def date_range(date)
|
74
|
+
from = date.at(("./from"))
|
75
|
+
to = date.at(("./to"))
|
76
|
+
on = date.at(("./on"))
|
77
|
+
return date.text unless from || on || to
|
78
|
+
return on.text.sub(/-.*$/, "") if on
|
79
|
+
|
80
|
+
ret = "#{from.text.sub(/-.*$/, '')}–"
|
81
|
+
ret += to.text.sub(/-.*$/, "") if to
|
82
|
+
ret
|
83
|
+
end
|
84
|
+
|
85
|
+
def format_ref(ref, type)
|
86
|
+
ref = ref.sub(/^BIPM /, "") if type == "BIPM"
|
87
|
+
super
|
88
|
+
end
|
89
|
+
|
160
90
|
def clause_parse(attrs, xml, node)
|
161
91
|
node.option?("unnumbered") and attrs[:unnumbered] = true
|
162
92
|
super
|
@@ -0,0 +1,113 @@
|
|
1
|
+
module Metanorma
|
2
|
+
module BIPM
|
3
|
+
class Converter < Metanorma::Generic::Converter
|
4
|
+
def metadata_committee(node, xml)
|
5
|
+
return unless node.attr("committee-en") || node.attr("committee-fr")
|
6
|
+
|
7
|
+
xml.editorialgroup do |a|
|
8
|
+
metadata_committee1(node, a)
|
9
|
+
i = 2
|
10
|
+
while node.attr("committee-en_#{i}") || node.attr("committee-fr_#{i}")
|
11
|
+
metadata_committee2(node, a, i)
|
12
|
+
i += 1
|
13
|
+
end
|
14
|
+
metadata_workgroup(node, a)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def metadata_committee1(node, xml)
|
19
|
+
xml.committee **attr_code(acronym:
|
20
|
+
node.attr("committee-acronym")) do |c|
|
21
|
+
e = node.attr("committee-en") and
|
22
|
+
c.variant e, language: "en", script: "Latn"
|
23
|
+
e = node.attr("committee-fr") and
|
24
|
+
c.variant e, language: "fr", script: "Latn"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def metadata_committee2(node, xml, num)
|
29
|
+
xml.committee **attr_code(acronym:
|
30
|
+
node.attr("committee-acronym_#{num}")) do |c|
|
31
|
+
%w(en fr).each do |lg|
|
32
|
+
e = node.attr("committee-#{lg}_#{num}") and
|
33
|
+
c.variant e, language: lg, script: "Latn"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def metadata_workgroup(node, xml)
|
39
|
+
xml.workgroup(node.attr("workgroup"),
|
40
|
+
**attr_code(acronym: node.attr("workgroup-acronym")))
|
41
|
+
i = 2
|
42
|
+
while node.attr("workgroup_#{i}")
|
43
|
+
xml.workgroup(
|
44
|
+
node.attr("workgroup_#{i}"),
|
45
|
+
**attr_code(acronym: node.attr("workgroup-acronym_#{i}")),
|
46
|
+
)
|
47
|
+
i += 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def metadata_relations(node, xml)
|
52
|
+
super
|
53
|
+
relation_supersedes_self(node, xml, "")
|
54
|
+
i = 2
|
55
|
+
while relation_supersedes_self(node, xml, "_#{i}")
|
56
|
+
i += 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def relation_supersedes_self(node, xml, suffix)
|
61
|
+
d = node.attr("supersedes-date#{suffix}")
|
62
|
+
draft = node.attr("supersedes-draft#{suffix}")
|
63
|
+
edition = node.attr("supersedes-edition#{suffix}")
|
64
|
+
return false unless d || draft || edition
|
65
|
+
|
66
|
+
relation_supersedes_self1(xml, d, edition, draft)
|
67
|
+
end
|
68
|
+
|
69
|
+
def relation_supersedes_self1(xml, date, edition, draft)
|
70
|
+
xml.relation **{ type: "supersedes" } do |r|
|
71
|
+
r.bibitem do |b|
|
72
|
+
date and b.date(date,
|
73
|
+
**{ type: edition ? "published" : "circulated" })
|
74
|
+
edition and b.edition edition
|
75
|
+
draft and b.version do |v|
|
76
|
+
v.draft draft
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def personal_role(node, xml, suffix)
|
83
|
+
role = node.attr("role#{suffix}") || "author"
|
84
|
+
unless %w(author editor).include?(role.downcase)
|
85
|
+
desc = role
|
86
|
+
role = "editor"
|
87
|
+
end
|
88
|
+
xml.role desc, **{ type: role.downcase }
|
89
|
+
end
|
90
|
+
|
91
|
+
def title(node, xml)
|
92
|
+
["en", "fr"].each do |lang|
|
93
|
+
at = { language: lang, format: "text/plain" }
|
94
|
+
xml.title **attr_code(at.merge(type: "main")) do |t1|
|
95
|
+
t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-#{lang}"))
|
96
|
+
end
|
97
|
+
%w(cover appendix annex part subpart provenance).each do |w|
|
98
|
+
typed_title(node, xml, lang, w)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def typed_title(node, xml, lang, type)
|
104
|
+
at = { language: lang, format: "text/plain" }
|
105
|
+
return unless title = node.attr("title-#{type}-#{lang}")
|
106
|
+
|
107
|
+
xml.title **attr_code(at.merge(type: type)) do |t1|
|
108
|
+
t1 << Metanorma::Utils::asciidoc_sub(title)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -32,6 +32,43 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="admonition">
|
36
|
+
<element name="admonition">
|
37
|
+
<attribute name="type">
|
38
|
+
<ref name="AdmonitionType"/>
|
39
|
+
</attribute>
|
40
|
+
<optional>
|
41
|
+
<attribute name="class"/>
|
42
|
+
</optional>
|
43
|
+
<attribute name="id">
|
44
|
+
<data type="ID"/>
|
45
|
+
</attribute>
|
46
|
+
<optional>
|
47
|
+
<attribute name="uri">
|
48
|
+
<data type="anyURI"/>
|
49
|
+
</attribute>
|
50
|
+
</optional>
|
51
|
+
<optional>
|
52
|
+
<attribute name="coverpage">
|
53
|
+
<data type="boolean"/>
|
54
|
+
</attribute>
|
55
|
+
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="notag">
|
58
|
+
<data type="boolean"/>
|
59
|
+
</attribute>
|
60
|
+
</optional>
|
61
|
+
<optional>
|
62
|
+
<ref name="tname"/>
|
63
|
+
</optional>
|
64
|
+
<zeroOrMore>
|
65
|
+
<ref name="paragraph-with-footnote"/>
|
66
|
+
</zeroOrMore>
|
67
|
+
<zeroOrMore>
|
68
|
+
<ref name="note"/>
|
69
|
+
</zeroOrMore>
|
70
|
+
</element>
|
71
|
+
</define>
|
35
72
|
<define name="index">
|
36
73
|
<element name="index">
|
37
74
|
<optional>
|
@@ -851,6 +888,16 @@
|
|
851
888
|
<ref name="MultilingualRenderingType"/>
|
852
889
|
</attribute>
|
853
890
|
</optional>
|
891
|
+
<optional>
|
892
|
+
<attribute name="coverpage">
|
893
|
+
<data type="boolean"/>
|
894
|
+
</attribute>
|
895
|
+
</optional>
|
896
|
+
<optional>
|
897
|
+
<attribute name="notag">
|
898
|
+
<data type="boolean"/>
|
899
|
+
</attribute>
|
900
|
+
</optional>
|
854
901
|
<oneOrMore>
|
855
902
|
<choice>
|
856
903
|
<ref name="paragraph"/>
|
@@ -1178,6 +1225,7 @@
|
|
1178
1225
|
<ref name="concept"/>
|
1179
1226
|
<ref name="add"/>
|
1180
1227
|
<ref name="del"/>
|
1228
|
+
<ref name="span"/>
|
1181
1229
|
</choice>
|
1182
1230
|
</define>
|
1183
1231
|
<define name="add">
|
@@ -1204,6 +1252,14 @@
|
|
1204
1252
|
</choice>
|
1205
1253
|
</element>
|
1206
1254
|
</define>
|
1255
|
+
<define name="span">
|
1256
|
+
<element name="span">
|
1257
|
+
<attribute name="class"/>
|
1258
|
+
<oneOrMore>
|
1259
|
+
<ref name="TextElement"/>
|
1260
|
+
</oneOrMore>
|
1261
|
+
</element>
|
1262
|
+
</define>
|
1207
1263
|
<define name="concept">
|
1208
1264
|
<element name="concept">
|
1209
1265
|
<optional>
|
data/metanorma-bipm.gemspec
CHANGED
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
|
-
spec.add_dependency "metanorma-generic", "~> 2.
|
30
|
-
spec.add_dependency "metanorma-iso", "~> 2.
|
29
|
+
spec.add_dependency "metanorma-generic", "~> 2.1.0"
|
30
|
+
spec.add_dependency "metanorma-iso", "~> 2.1.0"
|
31
31
|
|
32
32
|
spec.add_development_dependency "debug"
|
33
33
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|