metanorma-bipm 2.1.0 → 2.1.3
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 -0
- data/lib/isodoc/bipm/bipm.brochure.xsl +1393 -226
- data/lib/isodoc/bipm/bipm.guide.xsl +1393 -226
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +1393 -226
- data/lib/isodoc/bipm/bipm.rapport.xsl +1393 -226
- data/lib/isodoc/bipm/html/htmlstyle.css +6 -0
- data/lib/isodoc/bipm/html/htmlstyle.scss +1 -0
- data/lib/isodoc/bipm/jcgm.standard.xsl +1369 -214
- data/lib/isodoc/bipm/presentation_xml_convert.rb +15 -2
- data/lib/isodoc/bipm/xref.rb +22 -28
- data/lib/metanorma/bipm/biblio.rng +134 -39
- data/lib/metanorma/bipm/bipm.rng +3 -0
- data/lib/metanorma/bipm/converter.rb +41 -108
- data/lib/metanorma/bipm/front.rb +113 -0
- data/lib/metanorma/bipm/isodoc.rng +16 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- metadata +4 -3
@@ -165,10 +165,23 @@ module IsoDoc
|
|
165
165
|
elem.children = l10n("[#{@i18n.source} #{elem.children.to_xml.strip}]")
|
166
166
|
end
|
167
167
|
|
168
|
-
def
|
169
|
-
|
168
|
+
def expand_citeas(text)
|
169
|
+
ret = super
|
170
|
+
if @lang == "fr" && /^(CGPM|CIPM) /.match?(ret)
|
171
|
+
ret.sub!(/^(CGPM|CIPM) (\S+)/) do |_m|
|
172
|
+
"#{$1} – #{FR_OUTCOME_TYPE[$2.to_sym] || $2}"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
ret
|
170
176
|
end
|
171
177
|
|
178
|
+
FR_OUTCOME_TYPE = {
|
179
|
+
Resolution: "Résolution",
|
180
|
+
Decision: "Décision",
|
181
|
+
Recommendation: "Recommandation",
|
182
|
+
Declaration: "Déclaration",
|
183
|
+
}.freeze
|
184
|
+
|
172
185
|
include Init
|
173
186
|
end
|
174
187
|
end
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -22,9 +22,7 @@ module IsoDoc
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def wrap_brackets(txt)
|
25
|
-
|
26
|
-
|
27
|
-
"[#{txt}]"
|
25
|
+
/^\[.*\]$/.match?(txt) ? txt : "[#{txt}]"
|
28
26
|
end
|
29
27
|
|
30
28
|
def reference_names(ref)
|
@@ -34,10 +32,8 @@ module IsoDoc
|
|
34
32
|
end
|
35
33
|
|
36
34
|
def clause_names(docxml, sect_num)
|
37
|
-
if @jcgm
|
38
|
-
|
39
|
-
else
|
40
|
-
clause_names_bipm(docxml, sect_num)
|
35
|
+
if @jcgm then clause_names_jcgm(docxml, sect_num)
|
36
|
+
else clause_names_bipm(docxml, sect_num)
|
41
37
|
end
|
42
38
|
end
|
43
39
|
|
@@ -48,29 +44,29 @@ module IsoDoc
|
|
48
44
|
end
|
49
45
|
end
|
50
46
|
|
47
|
+
UNNUM = "@unnumbered = 'true'".freeze
|
48
|
+
|
51
49
|
def clause_names_bipm(docxml, _sect_num)
|
52
50
|
n = Counter.new
|
53
|
-
docxml.xpath(ns("//sections/clause[not(
|
54
|
-
"//sections/terms[not(
|
55
|
-
"//sections/definitions[not(
|
51
|
+
docxml.xpath(ns("//sections/clause[not(#{UNNUM})] | "\
|
52
|
+
"//sections/terms[not(#{UNNUM})] | "\
|
53
|
+
"//sections/definitions[not(#{UNNUM})]"))
|
56
54
|
.each { |c| section_names(c, n, 1) }
|
57
|
-
docxml.xpath(ns("//sections/clause[
|
58
|
-
"//sections/terms[
|
59
|
-
"//sections/definitions[
|
55
|
+
docxml.xpath(ns("//sections/clause[#{UNNUM}] | "\
|
56
|
+
"//sections/terms[#{UNNUM}] | "\
|
57
|
+
"//sections/definitions[#{UNNUM}]"))
|
60
58
|
.each { |c| unnumbered_section_names(c, 1) }
|
61
59
|
end
|
62
60
|
|
63
|
-
NUMBERED_SUBCLAUSES =
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
"./definitions[not(@unnumbered = 'true')]".freeze
|
61
|
+
NUMBERED_SUBCLAUSES =
|
62
|
+
"./clause[not(#{UNNUM})] | ./references[not(#{UNNUM})] | "\
|
63
|
+
"./term[not(#{UNNUM})] | ./terms[not(#{UNNUM})] | "\
|
64
|
+
"./definitions[not(#{UNNUM})]".freeze
|
68
65
|
|
69
|
-
UNNUMBERED_SUBCLAUSES =
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
"./definitions[@unnumbered = 'true']".freeze
|
66
|
+
UNNUMBERED_SUBCLAUSES =
|
67
|
+
"./clause[#{UNNUM}] | ./references[#{UNNUM}] | "\
|
68
|
+
"./term[#{UNNUM}] | ./terms[#{UNNUM}] | "\
|
69
|
+
"./definitions[#{UNNUM}]".freeze
|
74
70
|
|
75
71
|
def section_name_anchors(clause, num, lvl)
|
76
72
|
lbl = @jcgm ? "clause_jcgm" : "clause"
|
@@ -137,11 +133,11 @@ module IsoDoc
|
|
137
133
|
def back_anchor_names(docxml)
|
138
134
|
super
|
139
135
|
i = @jcgm ? Counter.new("@", skip_i: true) : Counter.new(0)
|
140
|
-
docxml.xpath(ns("//annex[not(
|
136
|
+
docxml.xpath(ns("//annex[not(#{UNNUM})]")).each do |c|
|
141
137
|
i.increment(c)
|
142
138
|
annex_names(c, i.print)
|
143
139
|
end
|
144
|
-
docxml.xpath(ns("//annex[
|
140
|
+
docxml.xpath(ns("//annex[#{UNNUM}]"))
|
145
141
|
.each { |c| unnumbered_annex_names(c) }
|
146
142
|
docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
|
147
143
|
end
|
@@ -231,12 +227,10 @@ module IsoDoc
|
|
231
227
|
|
232
228
|
def initial_anchor_names(doc)
|
233
229
|
super
|
234
|
-
if @parse_settings.empty? || @parse_settings[:clauses]
|
235
|
-
if @jcgm
|
230
|
+
if (@parse_settings.empty? || @parse_settings[:clauses]) && @jcgm
|
236
231
|
@iso.introduction_names(doc.at(ns("//introduction")))
|
237
232
|
@anchors.merge!(@iso.get)
|
238
233
|
end
|
239
|
-
end
|
240
234
|
end
|
241
235
|
|
242
236
|
def sequential_figure_names(clause)
|
@@ -614,12 +614,103 @@
|
|
614
614
|
<optional>
|
615
615
|
<ref name="fetched"/>
|
616
616
|
</optional>
|
617
|
-
<
|
618
|
-
<oneOrMore>
|
619
|
-
<ref name="btitle"/>
|
620
|
-
</oneOrMore>
|
617
|
+
<optional>
|
621
618
|
<ref name="formattedref"/>
|
622
|
-
</
|
619
|
+
</optional>
|
620
|
+
<oneOrMore>
|
621
|
+
<ref name="btitle"/>
|
622
|
+
</oneOrMore>
|
623
|
+
<zeroOrMore>
|
624
|
+
<ref name="bsource"/>
|
625
|
+
</zeroOrMore>
|
626
|
+
<oneOrMore>
|
627
|
+
<ref name="docidentifier"/>
|
628
|
+
</oneOrMore>
|
629
|
+
<optional>
|
630
|
+
<ref name="docnumber"/>
|
631
|
+
</optional>
|
632
|
+
<zeroOrMore>
|
633
|
+
<ref name="bdate"/>
|
634
|
+
</zeroOrMore>
|
635
|
+
<zeroOrMore>
|
636
|
+
<ref name="contributor"/>
|
637
|
+
</zeroOrMore>
|
638
|
+
<optional>
|
639
|
+
<ref name="edition"/>
|
640
|
+
</optional>
|
641
|
+
<zeroOrMore>
|
642
|
+
<ref name="version"/>
|
643
|
+
</zeroOrMore>
|
644
|
+
<zeroOrMore>
|
645
|
+
<ref name="biblionote"/>
|
646
|
+
</zeroOrMore>
|
647
|
+
<zeroOrMore>
|
648
|
+
<ref name="language"/>
|
649
|
+
</zeroOrMore>
|
650
|
+
<zeroOrMore>
|
651
|
+
<ref name="script"/>
|
652
|
+
</zeroOrMore>
|
653
|
+
<zeroOrMore>
|
654
|
+
<ref name="bibabstract"/>
|
655
|
+
</zeroOrMore>
|
656
|
+
<optional>
|
657
|
+
<ref name="status"/>
|
658
|
+
</optional>
|
659
|
+
<zeroOrMore>
|
660
|
+
<ref name="copyright"/>
|
661
|
+
</zeroOrMore>
|
662
|
+
<zeroOrMore>
|
663
|
+
<ref name="docrelation"/>
|
664
|
+
</zeroOrMore>
|
665
|
+
<zeroOrMore>
|
666
|
+
<ref name="series"/>
|
667
|
+
</zeroOrMore>
|
668
|
+
<optional>
|
669
|
+
<ref name="medium"/>
|
670
|
+
</optional>
|
671
|
+
<zeroOrMore>
|
672
|
+
<ref name="bplace"/>
|
673
|
+
</zeroOrMore>
|
674
|
+
<zeroOrMore>
|
675
|
+
<ref name="bprice"/>
|
676
|
+
</zeroOrMore>
|
677
|
+
<zeroOrMore>
|
678
|
+
<ref name="extent"/>
|
679
|
+
</zeroOrMore>
|
680
|
+
<optional>
|
681
|
+
<ref name="bibliographic_size"/>
|
682
|
+
</optional>
|
683
|
+
<zeroOrMore>
|
684
|
+
<ref name="accesslocation"/>
|
685
|
+
</zeroOrMore>
|
686
|
+
<zeroOrMore>
|
687
|
+
<ref name="license"/>
|
688
|
+
</zeroOrMore>
|
689
|
+
<zeroOrMore>
|
690
|
+
<ref name="bclassification"/>
|
691
|
+
</zeroOrMore>
|
692
|
+
<zeroOrMore>
|
693
|
+
<ref name="bkeyword"/>
|
694
|
+
</zeroOrMore>
|
695
|
+
<optional>
|
696
|
+
<ref name="validity"/>
|
697
|
+
</optional>
|
698
|
+
</define>
|
699
|
+
<define name="ReducedBibliographicItem">
|
700
|
+
<optional>
|
701
|
+
<attribute name="type">
|
702
|
+
<ref name="BibItemType"/>
|
703
|
+
</attribute>
|
704
|
+
</optional>
|
705
|
+
<optional>
|
706
|
+
<ref name="fetched"/>
|
707
|
+
</optional>
|
708
|
+
<optional>
|
709
|
+
<ref name="formattedref"/>
|
710
|
+
</optional>
|
711
|
+
<zeroOrMore>
|
712
|
+
<ref name="btitle"/>
|
713
|
+
</zeroOrMore>
|
623
714
|
<zeroOrMore>
|
624
715
|
<ref name="bsource"/>
|
625
716
|
</zeroOrMore>
|
@@ -638,9 +729,9 @@
|
|
638
729
|
<optional>
|
639
730
|
<ref name="edition"/>
|
640
731
|
</optional>
|
641
|
-
<
|
732
|
+
<zeroOrMore>
|
642
733
|
<ref name="version"/>
|
643
|
-
</
|
734
|
+
</zeroOrMore>
|
644
735
|
<zeroOrMore>
|
645
736
|
<ref name="biblionote"/>
|
646
737
|
</zeroOrMore>
|
@@ -833,6 +924,12 @@
|
|
833
924
|
<data type="boolean"/>
|
834
925
|
</attribute>
|
835
926
|
</optional>
|
927
|
+
<optional>
|
928
|
+
<attribute name="language"/>
|
929
|
+
</optional>
|
930
|
+
<optional>
|
931
|
+
<attribute name="script"/>
|
932
|
+
</optional>
|
836
933
|
<text/>
|
837
934
|
</element>
|
838
935
|
</define>
|
@@ -986,36 +1083,34 @@
|
|
986
1083
|
<ref name="SeriesType"/>
|
987
1084
|
</attribute>
|
988
1085
|
</optional>
|
989
|
-
<
|
1086
|
+
<optional>
|
990
1087
|
<ref name="formattedref"/>
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
</group>
|
1018
|
-
</choice>
|
1088
|
+
</optional>
|
1089
|
+
<ref name="btitle"/>
|
1090
|
+
<optional>
|
1091
|
+
<ref name="bplace"/>
|
1092
|
+
</optional>
|
1093
|
+
<optional>
|
1094
|
+
<ref name="seriesorganization"/>
|
1095
|
+
</optional>
|
1096
|
+
<optional>
|
1097
|
+
<ref name="abbreviation"/>
|
1098
|
+
</optional>
|
1099
|
+
<optional>
|
1100
|
+
<ref name="seriesfrom"/>
|
1101
|
+
</optional>
|
1102
|
+
<optional>
|
1103
|
+
<ref name="seriesto"/>
|
1104
|
+
</optional>
|
1105
|
+
<optional>
|
1106
|
+
<ref name="seriesnumber"/>
|
1107
|
+
</optional>
|
1108
|
+
<optional>
|
1109
|
+
<ref name="seriespartnumber"/>
|
1110
|
+
</optional>
|
1111
|
+
<optional>
|
1112
|
+
<ref name="seriesrun"/>
|
1113
|
+
</optional>
|
1019
1114
|
</element>
|
1020
1115
|
</define>
|
1021
1116
|
<define name="SeriesType">
|
@@ -1174,7 +1269,7 @@
|
|
1174
1269
|
</element>
|
1175
1270
|
</optional>
|
1176
1271
|
<element name="bibitem">
|
1177
|
-
<ref name="
|
1272
|
+
<ref name="ReducedBibliographicItem"/>
|
1178
1273
|
</element>
|
1179
1274
|
<choice>
|
1180
1275
|
<zeroOrMore>
|
@@ -1199,9 +1294,9 @@
|
|
1199
1294
|
<optional>
|
1200
1295
|
<ref name="revision-date"/>
|
1201
1296
|
</optional>
|
1202
|
-
<
|
1297
|
+
<optional>
|
1203
1298
|
<ref name="draft"/>
|
1204
|
-
</
|
1299
|
+
</optional>
|
1205
1300
|
</element>
|
1206
1301
|
</define>
|
1207
1302
|
<define name="vedition">
|
data/lib/metanorma/bipm/bipm.rng
CHANGED
@@ -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,46 @@ module Metanorma
|
|
157
50
|
ret
|
158
51
|
end
|
159
52
|
|
53
|
+
=begin
|
54
|
+
def reference_names(xmldoc)
|
55
|
+
xmldoc.xpath("//bibitem[not(ancestor::bibitem)]").each do |ref|
|
56
|
+
docid = ref.at("./docidentifier[@type = 'metanorma']") ||
|
57
|
+
ref.at("./docidentifier[not(@type = 'DOI')]") or next
|
58
|
+
#date = ref.at("./date[@type = 'published']")
|
59
|
+
#reference = format_ref(reference_names1(docid, date, docid["type"]),
|
60
|
+
#docid["type"])
|
61
|
+
reference = format_ref(docid.children.to_xml, docid["type"])
|
62
|
+
@anchors[ref["id"]] = { xref: reference }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def reference_names1(docid, date, type)
|
67
|
+
ret = docid.children.to_xml
|
68
|
+
if type == "BIPM" && date &&
|
69
|
+
/(CIPM|CGPM) (Decision|Resolution)/.match?(docid)
|
70
|
+
ret += " (#{date_range(date)})"
|
71
|
+
end
|
72
|
+
ret
|
73
|
+
end
|
74
|
+
=end
|
75
|
+
|
76
|
+
def date_range(date)
|
77
|
+
from = date.at(("./from"))
|
78
|
+
to = date.at(("./to"))
|
79
|
+
on = date.at(("./on"))
|
80
|
+
return date.text unless from || on || to
|
81
|
+
return on.text.sub(/-.*$/, "") if on
|
82
|
+
|
83
|
+
ret = "#{from.text.sub(/-.*$/, '')}–"
|
84
|
+
ret += to.text.sub(/-.*$/, "") if to
|
85
|
+
ret
|
86
|
+
end
|
87
|
+
|
88
|
+
def format_ref(ref, type)
|
89
|
+
ref = ref.sub(/^BIPM /, "") if type == "BIPM"
|
90
|
+
super
|
91
|
+
end
|
92
|
+
|
160
93
|
def clause_parse(attrs, xml, node)
|
161
94
|
node.option?("unnumbered") and attrs[:unnumbered] = true
|
162
95
|
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
|
@@ -282,6 +282,9 @@
|
|
282
282
|
<ref name="MultilingualRenderingType"/>
|
283
283
|
</attribute>
|
284
284
|
</optional>
|
285
|
+
<optional>
|
286
|
+
<ref name="tname"/>
|
287
|
+
</optional>
|
285
288
|
<oneOrMore>
|
286
289
|
<ref name="ul_li"/>
|
287
290
|
</oneOrMore>
|
@@ -324,6 +327,9 @@
|
|
324
327
|
</choice>
|
325
328
|
</attribute>
|
326
329
|
</optional>
|
330
|
+
<optional>
|
331
|
+
<ref name="tname"/>
|
332
|
+
</optional>
|
327
333
|
<oneOrMore>
|
328
334
|
<ref name="li"/>
|
329
335
|
</oneOrMore>
|
@@ -360,6 +366,9 @@
|
|
360
366
|
<ref name="MultilingualRenderingType"/>
|
361
367
|
</attribute>
|
362
368
|
</optional>
|
369
|
+
<optional>
|
370
|
+
<ref name="tname"/>
|
371
|
+
</optional>
|
363
372
|
<oneOrMore>
|
364
373
|
<ref name="dt"/>
|
365
374
|
<ref name="dd"/>
|
@@ -694,6 +703,9 @@
|
|
694
703
|
<optional>
|
695
704
|
<attribute name="tag"/>
|
696
705
|
</optional>
|
706
|
+
<optional>
|
707
|
+
<attribute name="type"/>
|
708
|
+
</optional>
|
697
709
|
<optional>
|
698
710
|
<attribute name="multilingual-rendering">
|
699
711
|
<ref name="MultilingualRenderingType"/>
|
@@ -729,6 +741,9 @@
|
|
729
741
|
<optional>
|
730
742
|
<attribute name="tag"/>
|
731
743
|
</optional>
|
744
|
+
<optional>
|
745
|
+
<attribute name="type"/>
|
746
|
+
</optional>
|
732
747
|
<optional>
|
733
748
|
<attribute name="multilingual-rendering">
|
734
749
|
<ref name="MultilingualRenderingType"/>
|
@@ -2050,6 +2065,7 @@
|
|
2050
2065
|
<value>compare</value>
|
2051
2066
|
<value>contrast</value>
|
2052
2067
|
<value>see</value>
|
2068
|
+
<value>seealso</value>
|
2053
2069
|
</choice>
|
2054
2070
|
</define>
|
2055
2071
|
<define name="deprecates">
|