metanorma-bipm 0.0.4 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f7ed7028b4a5bd6a311aff675bd47272c2170dad7adfcf59457ca3f4a55d218
4
- data.tar.gz: 96e9451da240b36fe420324838d69a0d5fde69cb956d74977f83b7ca9c736cae
3
+ metadata.gz: 70abc01a43829c12c4870dc4072a2a5f919cd2a5a7d306e579b3fa619020f851
4
+ data.tar.gz: 7ef810393fb2f5d107554fd45195f0297a3421d4deb0d314b6d9820456fbe93d
5
5
  SHA512:
6
- metadata.gz: 98b7383018c3822867381823ed9d19bc4cd02e5db2fbf97862014bde19079e13f28fc1e0342b3d41986b3a0d249104746a14f475db05fe6a273bb8c860bc8df6
7
- data.tar.gz: 531be848c577965373bdbab1408304b06fc292998b89e2fdc3f81948ba93799a4a9f0a4b19897974ea6fb38518738ab6ac9cb33196dee90fd04305ef5825d16b
6
+ metadata.gz: cd67915975f6dc2107e1868bc62bb6942ba9f1fe4f6dcee81d48334d45b2e02053513d51f3fe792e439f66387208ac33d288713513015761b1e27a5dbae24329
7
+ data.tar.gz: ede610fd77af7ea69e3073e88fde59c0bd567699fbda50b51bfcb3fad47f4aad00a3bf1e59b4597fa9c2a0485e9ea69c1dcb5b5a7bf430794e78cbd1667a3dab
@@ -36,7 +36,10 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
- - uses: actions/cache@v1
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
41
+
42
+ - uses: actions/cache@v2
40
43
  with:
41
44
  path: vendor/bundle
42
45
  key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
@@ -48,16 +51,15 @@ jobs:
48
51
 
49
52
  - run: bundle exec rake
50
53
 
51
- notify:
52
- name: Trigger notify workflow
54
+ tests-passed:
53
55
  needs: rake
54
56
  runs-on: ubuntu-latest
55
57
  steps:
56
- - name: Trigger notify workflow
58
+ - name: Trigger tests passed event
57
59
  uses: Sibz/github-status-action@v1
58
60
  with:
59
- authToken: ${{ secrets.GITHUB_TOKEN }}
61
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
60
62
  context: 'tests-passed-successfully'
61
63
  description: 'Tests passed successfully'
62
64
  state: 'success'
63
- sha: ${{ github.event.pull_request.head.sha || github.sha }}
65
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,13 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
732
  <optional>
733
- <attribute name="secondary"/>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
737
+ <element name="primary">
738
+ <oneOrMore>
739
+ <ref name="PureTextElement"/>
740
+ </oneOrMore>
741
+ </element>
742
+ <optional>
743
+ <element name="secondary">
744
+ <oneOrMore>
745
+ <ref name="PureTextElement"/>
746
+ </oneOrMore>
747
+ </element>
748
+ </optional>
749
+ <optional>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
755
+ </optional>
756
+ </element>
757
+ </define>
758
+ <define name="index-xref">
759
+ <element name="index-xref">
760
+ <attribute name="also">
761
+ <data type="boolean"/>
762
+ </attribute>
763
+ <element name="primary">
764
+ <oneOrMore>
765
+ <ref name="PureTextElement"/>
766
+ </oneOrMore>
767
+ </element>
768
+ <optional>
769
+ <element name="secondary">
770
+ <oneOrMore>
771
+ <ref name="PureTextElement"/>
772
+ </oneOrMore>
773
+ </element>
734
774
  </optional>
735
775
  <optional>
736
- <attribute name="tertiary"/>
776
+ <element name="tertiary">
777
+ <oneOrMore>
778
+ <ref name="PureTextElement"/>
779
+ </oneOrMore>
780
+ </element>
737
781
  </optional>
782
+ <element name="target">
783
+ <oneOrMore>
784
+ <ref name="PureTextElement"/>
785
+ </oneOrMore>
786
+ </element>
738
787
  </element>
739
788
  </define>
740
789
  <!-- bare ID element, used for referencing arbitrary spans of text -->
@@ -42,6 +42,16 @@
42
42
  <data type="boolean"/>
43
43
  </attribute>
44
44
  </optional>
45
+ <optional>
46
+ <attribute name="nosee">
47
+ <data type="boolean"/>
48
+ </attribute>
49
+ </optional>
50
+ <optional>
51
+ <attribute name="nopage">
52
+ <data type="boolean"/>
53
+ </attribute>
54
+ </optional>
45
55
  <text/>
46
56
  </element>
47
57
  </define>
@@ -209,9 +219,9 @@
209
219
  <oneOrMore>
210
220
  <ref name="committee"/>
211
221
  </oneOrMore>
212
- <oneOrMore>
222
+ <zeroOrMore>
213
223
  <ref name="workgroup"/>
214
- </oneOrMore>
224
+ </zeroOrMore>
215
225
  </element>
216
226
  </define>
217
227
  <define name="structuredidentifier">
@@ -333,7 +343,9 @@
333
343
  <optional>
334
344
  <ref name="boilerplate"/>
335
345
  </optional>
336
- <ref name="preface"/>
346
+ <optional>
347
+ <ref name="preface"/>
348
+ </optional>
337
349
  <oneOrMore>
338
350
  <ref name="sections"/>
339
351
  </oneOrMore>
@@ -1,7 +1,7 @@
1
1
  <boilerplate>
2
2
  <copyright-statement>
3
3
  <clause>
4
- <p align="center"> © Bureau International des poids et mesures {{ docyear }} all rights reserved</p>
4
+ <p align="center"> © Bureau International des Poids et Mesures {{ docyear }} all rights reserved</p>
5
5
  </clause>
6
6
  </copyright-statement>
7
7
  <license-statement>
@@ -1,7 +1,7 @@
1
1
  <boilerplate>
2
2
  <copyright-statement>
3
3
  <clause>
4
- <p align="center"> © Bureau International des poids et mesures {{ docyear }} tous droits réservés</p>
4
+ <p align="center"> © Bureau international des poids et mesures {{ docyear }} tous droits réservés</p>
5
5
  </clause>
6
6
  </copyright-statement>
7
7
  <license-statement>
@@ -0,0 +1,37 @@
1
+ <boilerplate>
2
+ <copyright-statement>
3
+ <clause>
4
+ <p> © JCGM {{ docyear }} </p>
5
+ <p>Copyright of this JCGM guidance document is shared jointly by the JCGM member organizations (BIPM, IEC,
6
+ IFCC, ILAC, ISO, IUPAC, IUPAP and OIML).</p>
7
+ </clause>
8
+ </copyright-statement>
9
+ <license-statement>
10
+ <clause>
11
+ <title>Copyright</title>
12
+ <p>Even if electronic versions are available free of charge on the website of one or more of the JCGM member organizations, economic and moral copyrights related to all JCGM publications are internationally protected. The JCGM does not, without its written authorisation, permit third parties to rewrite or re-brand issues, to sell copies to the public, or to broadcast or use on-line its publications. Equally, the JCGM also objects to distortion, augmentation or mutilation of its publications, including its titles, slogans and logos, and those of its member organizations.</p>
13
+ </clause>
14
+ <clause>
15
+ <title>Official versions and translations</title>
16
+ <p>The only official versions of documents are those published by the JCGM, in their original languages.</p>
17
+
18
+ <p>The JCGM’s publications may be translated into languages other than those in which the documents were originally published by the JCGM. Permission must be obtained from the JCGM before a translation can be made. All translations should respect the original and official format of the formulae and units (without any conversion to other formulae or units), and contain the following statement (to be translated into the chosen language):</p>
19
+
20
+ <quote>All JCGM’s products are internationally protected by copyright. This translation of the original JCGM document has been produced with the permission of the JCGM. The JCGM retains full internationally protected copyright on the design and content of this document and on the JCGM’s titles, slogan and logos. The member organizations of the JCGM also retain full internationally protected right on their titles, slogans and logos included in the JCGM’s publications. The only official version is the document published by the JCGM, in the original languages.</quote>
21
+
22
+ <p>The JCGM does not accept any liability for the relevance, accuracy, completeness or quality of the information and materials offered in any translation. A copy of the translation shall be provided to the JCGM at the time of publication.</p>
23
+ </clause>
24
+ <clause>
25
+ <title>Reproduction</title>
26
+ <p>The JCGM’s publications may be reproduced, provided written permission has been granted by the JCGM. A sample of any reproduced document shall be provided to the JCGM at the time of reproduction and contain the following statement:</p>
27
+ <quote>This document is reproduced with the permission of the JCGM, which retains full internationally protected copyright on the design and content of this document and on the JCGM’s titles, slogans and logos. The member organizations of the JCGM also retain full internationally protected right on their titles, slogans and logos included in the JCGM’s publications. The only official versions are the original versions of the documents published by the JCGM.</quote>
28
+ </clause>
29
+ </license-statement>
30
+ <legal-statement>
31
+ <clause>
32
+ <title>Disclaimer</title>
33
+ <p>The JCGM and its member organizations have published this document to enhance access to information about metrology. They endeavor to update it on a regular basis, but cannot guarantee the accuracy at all times and shall not be responsible for any direct or indirect damage that may result from its use. Any reference to commercial products of any kind (including but not restricted to any software, data or hardware) or links to websites, over which the JCGM and its member organizations have no control and for which they assume no responsibility, does not imply any approval, endorsement or recommendation by the JCGM and its member organizations.</p>
34
+ </clause>
35
+ </legal-statement>
36
+ </boilerplate>
37
+
@@ -10,6 +10,18 @@ module Asciidoctor
10
10
  Metanorma::BIPM.configuration
11
11
  end
12
12
 
13
+ def org_name_long
14
+ configuration.organization_name_long[@lang]
15
+ end
16
+
17
+ def default_publisher
18
+ org_name_long
19
+ end
20
+
21
+ def org_abbrev
22
+ { org_name_long => configuration.organization_name_short }
23
+ end
24
+
13
25
  def metadata_committee(node, xml)
14
26
  return unless node.attr("committee-en") || node.attr("committee-fr")
15
27
  xml.editorialgroup do |a|
@@ -30,14 +42,10 @@ module Asciidoctor
30
42
 
31
43
  def metadata_committee2(node, a)
32
44
  i = 2
33
- while node.attr("committee-en_#{i}") ||
34
- node.attr("committee-fr_#{i}") do
35
- a.committee **attr_code(acronym:
36
- node.attr("committee-acronym_#{i}")) do |c|
37
- e = node.attr("committee-en_#{i}") and
38
- c.variant e, language: "en", script: "Latn"
39
- e = node.attr("committee-fr_#{i}") and
40
- c.variant e, language: "fr", script: "Latn"
45
+ while node.attr("committee-en_#{i}") || node.attr("committee-fr_#{i}") do
46
+ a.committee **attr_code(acronym: node.attr("committee-acronym_#{i}")) do |c|
47
+ e = node.attr("committee-en_#{i}") and c.variant e, language: "en", script: "Latn"
48
+ e = node.attr("committee-fr_#{i}") and c.variant e, language: "fr", script: "Latn"
41
49
  end
42
50
  i += 1
43
51
  end
@@ -96,13 +104,11 @@ module Asciidoctor
96
104
  ["en", "fr"].each do |lang|
97
105
  at = { language: lang, format: "text/plain" }
98
106
  xml.title **attr_code(at.merge(type: "main")) do |t1|
99
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(
100
- node.attr("title-#{lang}"))
107
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-#{lang}"))
108
+ end
109
+ %w(cover appendix annex part subpart).each do |w|
110
+ typed_title(node, xml, lang, w)
101
111
  end
102
- typed_title(node, xml, lang, "cover")
103
- typed_title(node, xml, lang, "appendix")
104
- typed_title(node, xml, lang, "part")
105
- typed_title(node, xml, lang, "subpart")
106
112
  end
107
113
  end
108
114
 
@@ -110,7 +116,7 @@ module Asciidoctor
110
116
  at = { language: lang, format: "text/plain" }
111
117
  return unless title = node.attr("title-#{type}-#{lang}")
112
118
  xml.title **attr_code(at.merge(type: type)) do |t1|
113
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(title)
119
+ t1 << Metanorma::Utils::asciidoc_sub(title)
114
120
  end
115
121
  end
116
122
 
@@ -123,11 +129,15 @@ module Asciidoctor
123
129
  end
124
130
 
125
131
  def inline_anchor_xref_attrs(node)
126
- if /pagenumber%/.match(node.text)
127
- node.text = node.text.sub(/pagenumber%/, "")
128
- page = true
132
+ flags = %w(pagenumber nosee nopage).each_with_object({}) do |w, m|
133
+ if /#{w}%/.match(node.text)
134
+ node.text = node.text.sub(/#{w}%/, "")
135
+ m[w] = true
136
+ end
129
137
  end
130
- page ? super.merge(pagenumber: true) : super
138
+ ret = super
139
+ flags.keys.each { |k| ret[k.to_sym] = true }
140
+ ret
131
141
  end
132
142
 
133
143
  def clause_parse(attrs, xml, node)
@@ -162,6 +172,11 @@ module Asciidoctor
162
172
  end
163
173
  end
164
174
 
175
+ def boilerplate_file(xmldoc)
176
+ return super unless xmldoc&.at("//bibdata/ext/editorialgroup/committee/@acronym")&.value == "JCGM"
177
+ baselocation("lib/asciidoctor/bipm/boilerplate-jcgm-en.xml")
178
+ end
179
+
165
180
  def mathml_mi_italics
166
181
  { uppergreek: false, upperroman: false,
167
182
  lowergreek: false, lowerroman: true }
@@ -55,6 +55,13 @@
55
55
  <param name="pattern">\i\c*|\c+#\c+</param>
56
56
  </data>
57
57
  </attribute>
58
+ <optional>
59
+ <attribute name="to">
60
+ <data type="string">
61
+ <param name="pattern">\i\c*|\c+#\c+</param>
62
+ </data>
63
+ </attribute>
64
+ </optional>
58
65
  <optional>
59
66
  <attribute name="type">
60
67
  <ref name="ReferenceFormat"/>
@@ -246,6 +253,12 @@
246
253
  <data type="boolean"/>
247
254
  </attribute>
248
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
249
262
  <optional>
250
263
  <ref name="tname"/>
251
264
  </optional>
@@ -764,6 +777,21 @@
764
777
  </define>
765
778
  </include>
766
779
  <!-- end overrides -->
780
+ <define name="colgroup">
781
+ <element name="colgroup">
782
+ <oneOrMore>
783
+ <ref name="col"/>
784
+ </oneOrMore>
785
+ </element>
786
+ </define>
787
+ <define name="col">
788
+ <element name="col">
789
+ <attribute name="width"/>
790
+ </element>
791
+ </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
767
795
  <define name="TextElement" combine="choice">
768
796
  <ref name="concept"/>
769
797
  </define>
@@ -814,6 +842,9 @@
814
842
  <data type="boolean"/>
815
843
  </attribute>
816
844
  </optional>
845
+ <optional>
846
+ <attribute name="number"/>
847
+ </optional>
817
848
  <optional>
818
849
  <attribute name="obligation">
819
850
  <choice>
@@ -869,9 +900,11 @@
869
900
  <element name="code">
870
901
  <text/>
871
902
  </element>
872
- <element name="text">
873
- <text/>
874
- </element>
903
+ <optional>
904
+ <element name="text">
905
+ <text/>
906
+ </element>
907
+ </optional>
875
908
  </element>
876
909
  </define>
877
910
  <define name="standard-document">
@@ -1041,6 +1074,9 @@
1041
1074
  </choice>
1042
1075
  </attribute>
1043
1076
  </optional>
1077
+ <optional>
1078
+ <attribute name="number"/>
1079
+ </optional>
1044
1080
  <optional>
1045
1081
  <attribute name="type"/>
1046
1082
  </optional>
@@ -1094,6 +1130,9 @@
1094
1130
  <optional>
1095
1131
  <attribute name="type"/>
1096
1132
  </optional>
1133
+ <optional>
1134
+ <attribute name="number"/>
1135
+ </optional>
1097
1136
  <optional>
1098
1137
  <ref name="section-title"/>
1099
1138
  </optional>
@@ -1196,6 +1235,9 @@
1196
1235
  <optional>
1197
1236
  <attribute name="type"/>
1198
1237
  </optional>
1238
+ <optional>
1239
+ <attribute name="number"/>
1240
+ </optional>
1199
1241
  <optional>
1200
1242
  <attribute name="obligation">
1201
1243
  <choice>
@@ -1524,6 +1566,7 @@
1524
1566
  <value>add</value>
1525
1567
  <value>modify</value>
1526
1568
  <value>delete</value>
1569
+ <value>replace</value>
1527
1570
  </choice>
1528
1571
  </attribute>
1529
1572
  <optional>
@@ -1554,6 +1597,11 @@
1554
1597
  </optional>
1555
1598
  <optional>
1556
1599
  <element name="newcontent">
1600
+ <optional>
1601
+ <attribute name="id">
1602
+ <data type="ID"/>
1603
+ </attribute>
1604
+ </optional>
1557
1605
  <zeroOrMore>
1558
1606
  <ref name="BasicBlock"/>
1559
1607
  </zeroOrMore>
@@ -7,16 +7,64 @@ module IsoDoc
7
7
  Metanorma::BIPM.configuration
8
8
  end
9
9
 
10
+ def convert1(docxml, filename, dir)
11
+ @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))&.value == "JCGM"
12
+ super
13
+ end
14
+
10
15
  def middle(isoxml, out)
11
- middle_title(out)
12
- middle_admonitions(isoxml, out)
13
- clause isoxml, out
14
- annex isoxml, out
15
- bibliography isoxml, out
16
+ if @jcgm
17
+ super
18
+ else
19
+ middle_title(isoxml, out)
20
+ middle_admonitions(isoxml, out)
21
+ clause isoxml, out
22
+ annex isoxml, out
23
+ bibliography isoxml, out
24
+ end
25
+ end
26
+
27
+ def middle_clause(docxml)
28
+ if @jcgm
29
+ super
30
+ else
31
+ "//sections/*"
32
+ end
33
+ end
34
+
35
+ def render_identifier(id)
36
+ ret = super
37
+ ret[1] = nil if !id[1].nil? && id[1]["type"] == "BIPM"
38
+ ret[2] = nil if !id[2].nil? && id[2]["type"] == "BIPM"
39
+ ret
40
+ end
41
+
42
+ def nonstd_bibitem(list, b, ordinal, biblio)
43
+ list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
44
+ ids = bibitem_ref_code(b)
45
+ identifiers = render_identifier(ids)
46
+ if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
47
+ else
48
+ ref << "#{identifiers[0] || identifiers[1]}"
49
+ ref << " #{identifiers[1]}" if identifiers[0] && identifiers[1]
50
+ end
51
+ ref << " " unless biblio && !identifiers[1]
52
+ reference_format(b, ref)
53
+ end
16
54
  end
17
55
 
18
- def middle_clause
19
- "//sections/*"
56
+ def std_bibitem_entry(list, b, ordinal, biblio)
57
+ list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
58
+ identifiers = render_identifier(bibitem_ref_code(b))
59
+ if biblio then ref_entry_code(ref, ordinal, identifiers, nil)
60
+ else
61
+ ref << "#{identifiers[0] || identifiers[1]}"
62
+ ref << " #{identifiers[1]}" if identifiers[0] && identifiers[1]
63
+ end
64
+ date_note_process(b, ref)
65
+ ref << " " unless biblio && !identifiers[1]
66
+ reference_format(b, ref)
67
+ end
20
68
  end
21
69
  end
22
70
  end