metanorma-bipm 2.1.1 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -164,11 +164,7 @@ module IsoDoc
164
164
  end
165
165
  elem.children = l10n("[#{@i18n.source} #{elem.children.to_xml.strip}]")
166
166
  end
167
-
168
- def bibliography_bibitem_number_skip(bibitem)
169
- super || @xrefs.klass.standard?(bibitem)
170
- end
171
-
167
+ =begin
172
168
  def expand_citeas(text)
173
169
  ret = super
174
170
  if @lang == "fr" && /^(CGPM|CIPM) /.match?(ret)
@@ -184,7 +180,9 @@ module IsoDoc
184
180
  Decision: "Décision",
185
181
  Recommendation: "Recommandation",
186
182
  Declaration: "Déclaration",
183
+ Meeting: "Réunion",
187
184
  }.freeze
185
+ =end
188
186
 
189
187
  include Init
190
188
  end
@@ -22,9 +22,7 @@ module IsoDoc
22
22
  end
23
23
 
24
24
  def wrap_brackets(txt)
25
- return txt if /^\[.*\]$/.match?(txt)
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
- clause_names_jcgm(docxml, sect_num)
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(@unnumbered = 'true')] | "\
54
- "//sections/terms[not(@unnumbered = 'true')] | "\
55
- "//sections/definitions[not(@unnumbered = 'true')]"))
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[@unnumbered = 'true'] | "\
58
- "//sections/terms[@unnumbered = 'true'] | "\
59
- "//sections/definitions[@unnumbered = 'true']"))
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 = "./clause[not(@unnumbered = 'true')] | "\
64
- "./references[not(@unnumbered = 'true')] | "\
65
- "./term[not(@unnumbered = 'true')] | "\
66
- "./terms[not(@unnumbered = 'true')] | "\
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 = "./clause[@unnumbered = 'true'] | "\
70
- "./references[@unnumbered = 'true'] | "\
71
- "./term[@unnumbered = 'true'] | "\
72
- "./terms[@unnumbered = 'true'] | "\
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(@unnumbered = 'true')]")).each do |c|
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[@unnumbered = 'true']"))
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
- <choice>
618
- <oneOrMore>
619
- <ref name="btitle"/>
620
- </oneOrMore>
617
+ <optional>
621
618
  <ref name="formattedref"/>
622
- </choice>
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
- <optional>
732
+ <zeroOrMore>
642
733
  <ref name="version"/>
643
- </optional>
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
- <choice>
1086
+ <optional>
990
1087
  <ref name="formattedref"/>
991
- <group>
992
- <ref name="btitle"/>
993
- <optional>
994
- <ref name="bplace"/>
995
- </optional>
996
- <optional>
997
- <ref name="seriesorganization"/>
998
- </optional>
999
- <optional>
1000
- <ref name="abbreviation"/>
1001
- </optional>
1002
- <optional>
1003
- <ref name="seriesfrom"/>
1004
- </optional>
1005
- <optional>
1006
- <ref name="seriesto"/>
1007
- </optional>
1008
- <optional>
1009
- <ref name="seriesnumber"/>
1010
- </optional>
1011
- <optional>
1012
- <ref name="seriespartnumber"/>
1013
- </optional>
1014
- <optional>
1015
- <ref name="seriesrun"/>
1016
- </optional>
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="BibliographicItem"/>
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
- <zeroOrMore>
1297
+ <optional>
1203
1298
  <ref name="draft"/>
1204
- </zeroOrMore>
1299
+ </optional>
1205
1300
  </element>
1206
1301
  </define>
1207
1302
  <define name="vedition">
@@ -198,6 +198,9 @@
198
198
  <optional>
199
199
  <attribute name="start"/>
200
200
  </optional>
201
+ <optional>
202
+ <ref name="tname"/>
203
+ </optional>
201
204
  <oneOrMore>
202
205
  <ref name="li"/>
203
206
  </oneOrMore>
@@ -50,13 +50,15 @@ module Metanorma
50
50
  ret
51
51
  end
52
52
 
53
+ =begin
53
54
  def reference_names(xmldoc)
54
55
  xmldoc.xpath("//bibitem[not(ancestor::bibitem)]").each do |ref|
55
56
  docid = ref.at("./docidentifier[@type = 'metanorma']") ||
56
57
  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"])
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"])
60
62
  @anchors[ref["id"]] = { xref: reference }
61
63
  end
62
64
  end
@@ -69,6 +71,7 @@ module Metanorma
69
71
  end
70
72
  ret
71
73
  end
74
+ =end
72
75
 
73
76
  def date_range(date)
74
77
  from = date.at(("./from"))
@@ -116,6 +116,11 @@
116
116
  <data type="boolean"/>
117
117
  </attribute>
118
118
  </optional>
119
+ <optional>
120
+ <attribute name="suppress_identifier">
121
+ <data type="boolean"/>
122
+ </attribute>
123
+ </optional>
119
124
  <ref name="BibliographicItem"/>
120
125
  </element>
121
126
  </define>
@@ -282,6 +287,9 @@
282
287
  <ref name="MultilingualRenderingType"/>
283
288
  </attribute>
284
289
  </optional>
290
+ <optional>
291
+ <ref name="tname"/>
292
+ </optional>
285
293
  <oneOrMore>
286
294
  <ref name="ul_li"/>
287
295
  </oneOrMore>
@@ -324,6 +332,9 @@
324
332
  </choice>
325
333
  </attribute>
326
334
  </optional>
335
+ <optional>
336
+ <ref name="tname"/>
337
+ </optional>
327
338
  <oneOrMore>
328
339
  <ref name="li"/>
329
340
  </oneOrMore>
@@ -360,6 +371,9 @@
360
371
  <ref name="MultilingualRenderingType"/>
361
372
  </attribute>
362
373
  </optional>
374
+ <optional>
375
+ <ref name="tname"/>
376
+ </optional>
363
377
  <oneOrMore>
364
378
  <ref name="dt"/>
365
379
  <ref name="dd"/>
@@ -694,6 +708,9 @@
694
708
  <optional>
695
709
  <attribute name="tag"/>
696
710
  </optional>
711
+ <optional>
712
+ <attribute name="type"/>
713
+ </optional>
697
714
  <optional>
698
715
  <attribute name="multilingual-rendering">
699
716
  <ref name="MultilingualRenderingType"/>
@@ -729,6 +746,9 @@
729
746
  <optional>
730
747
  <attribute name="tag"/>
731
748
  </optional>
749
+ <optional>
750
+ <attribute name="type"/>
751
+ </optional>
732
752
  <optional>
733
753
  <attribute name="multilingual-rendering">
734
754
  <ref name="MultilingualRenderingType"/>
@@ -2050,6 +2070,7 @@
2050
2070
  <value>compare</value>
2051
2071
  <value>contrast</value>
2052
2072
  <value>see</value>
2073
+ <value>seealso</value>
2053
2074
  </choice>
2054
2075
  </define>
2055
2076
  <define name="deprecates">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.1.1".freeze
3
+ VERSION = "2.1.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-16 00:00:00.000000000 Z
11
+ date: 2022-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  - !ruby/object:Gem::Version
301
301
  version: '0'
302
302
  requirements: []
303
- rubygems_version: 3.3.9
303
+ rubygems_version: 3.3.16
304
304
  signing_key:
305
305
  specification_version: 4
306
306
  summary: metanorma-bipm lets you write BIPM standards in Metanorma.