metanorma-iec 1.2.7 → 1.2.8

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: 065b3fdee8a57faf2f698c80f57ece1e0c234b10833e3187cb879bb683778257
4
- data.tar.gz: 12ca28a168eab53a8970421542b883e06c638a535f0648cc7d64babcba4a1314
3
+ metadata.gz: be313ed8f65e342c6adcaa1ff76274c73fdde6dac85574478738546a7ed053e2
4
+ data.tar.gz: ea8b8af41ee6a45908d6511c5bac96cac3abec5f26b804a829f35d394bc1d10b
5
5
  SHA512:
6
- metadata.gz: 164fecc81e42574d17b366f0f04fde0e12476197fa9d7866d9652854fd181c2eb90a08fffa7ef30d5c7382f6caf318069fef95426a28314be7d22e7d0a105e5e
7
- data.tar.gz: dda40f72589b9a8de4ae3a56a86101a480c1e570880962bec551410e190fc2b5a0d83383124037f5135ef419e0a901a0a68626fb5241da5f33b7ed9c1ccf4217
6
+ metadata.gz: 604b9cccc08a30d7b253abb751f0e5bd65802d29fdce52487d6691b0bc5618afe458fa90acfdfc84199f256aa42d3ea9936d8051a8a85198ceefb3288e96325a
7
+ data.tar.gz: 12f1f61274fb6ead57ca15578cccbe8f90bd34afa4c2b82074c4ebc1263fb7313c9e60f21809c1a05cd85a1f5a5cebfcc85e0d7a5bea2c8d9d5f7f456dd087ec
@@ -4,7 +4,8 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master ]
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
8
9
  pull_request:
9
10
 
10
11
  jobs:
@@ -31,14 +32,32 @@ jobs:
31
32
  steps:
32
33
  - uses: actions/checkout@master
33
34
 
34
- - name: Use Ruby
35
- uses: ruby/setup-ruby@v1
35
+ - uses: ruby/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
- bundler-cache: true
39
38
 
40
- - name: Update gems
41
- run: bundle install --jobs 4 --retry 3
39
+ - uses: actions/cache@v1
40
+ with:
41
+ path: vendor/bundle
42
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
+
45
+ - run: bundle config set path 'vendor/bundle'
46
+
47
+ - run: bundle install --jobs 4 --retry 3
42
48
 
43
- - name: Run specs
44
- run: bundle exec rake
49
+ - run: bundle exec rake
50
+
51
+ notify:
52
+ name: Trigger notify workflow
53
+ needs: rake
54
+ runs-on: ubuntu-latest
55
+ steps:
56
+ - name: Trigger notify workflow
57
+ uses: Sibz/github-status-action@v1
58
+ with:
59
+ authToken: ${{ secrets.GITHUB_TOKEN }}
60
+ context: 'tests-passed-successfully'
61
+ description: 'Tests passed successfully'
62
+ state: 'success'
63
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -1,16 +1,15 @@
1
1
  = metanorma-iec: Metanorma processor for the International Electrotechnical Commission
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-iec.svg["Gem Version", link="https://rubygems.org/gems/metanorma-iec"]
4
- image:https://github.com/metanorma/metanorma-iec/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-iec/actions?workflow=macos"]
5
- image:https://github.com/metanorma/metanorma-iec/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-iec/actions?workflow=ubuntu"]
6
- image:https://github.com/metanorma/metanorma-iec/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-iec/actions?workflow=windows"]
4
+ image:https://github.com/metanorma/metanorma-iec/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-iec/actions?workflow=rake"]
7
5
  image:https://codeclimate.com/github/metanorma/metanorma-iec/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-iec"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-iec.svg["Pull Requests", link="https://github.com/metanorma/metanorma-iec/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-iec/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-iec/releases"]
10
8
 
11
9
  == Functionality
12
10
 
13
- This gem processes Metanorma documents into the IEC document class.
11
+ This gem processes https://www.metanorma.com[Metanorma documents] following
12
+ the Metanorma model for generating IEC standards.
14
13
 
15
14
  The gem is basically the https://github.com/metanorma/metanorma-iso gem, with some tweaking of rendering to meet the particular requirements of the IEC.
16
15
 
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -141,6 +149,11 @@
141
149
  <data type="boolean"/>
142
150
  </attribute>
143
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
144
157
  <oneOrMore>
145
158
  <ref name="dt"/>
146
159
  <ref name="dd"/>
@@ -2190,15 +2190,24 @@
2190
2190
 
2191
2191
  <xsl:text>Part #: </xsl:text>
2192
2192
 
2193
+
2193
2194
  </title-part>
2194
2195
  <title-part lang="fr">
2195
2196
 
2196
2197
 
2197
2198
  <xsl:text>Partie #: </xsl:text>
2198
2199
 
2200
+
2199
2201
  </title-part>
2200
2202
  <title-part lang="zh">第 # 部分:</title-part>
2201
2203
 
2204
+ <title-subpart lang="en">
2205
+
2206
+ </title-subpart>
2207
+ <title-subpart lang="fr">
2208
+
2209
+ </title-subpart>
2210
+
2202
2211
  <title-modified lang="en">modified</title-modified>
2203
2212
  <title-modified lang="fr">modifiée</title-modified>
2204
2213
 
@@ -2662,7 +2671,9 @@
2662
2671
 
2663
2672
 
2664
2673
 
2665
-
2674
+ <!-- <xsl:if test="$namespace = 'bipm'">
2675
+ <fo:block>&#xA0;</fo:block>
2676
+ </xsl:if> -->
2666
2677
 
2667
2678
  <!-- $namespace = 'iso' or -->
2668
2679
 
@@ -2833,6 +2844,7 @@
2833
2844
  <xsl:if test="normalize-space() != ''">
2834
2845
  <fo:block xsl:use-attribute-sets="table-name-style">
2835
2846
 
2847
+
2836
2848
  <xsl:apply-templates/>
2837
2849
  </fo:block>
2838
2850
  </xsl:if>
@@ -3216,6 +3228,7 @@
3216
3228
 
3217
3229
 
3218
3230
 
3231
+
3219
3232
  <!-- <xsl:if test="$namespace = 'bipm'">
3220
3233
  <xsl:attribute name="height">8mm</xsl:attribute>
3221
3234
  </xsl:if> -->
@@ -3320,7 +3333,8 @@
3320
3333
  </xsl:attribute>
3321
3334
  </xsl:if>
3322
3335
  <xsl:call-template name="display-align"/>
3323
- <fo:block>
3336
+ <fo:block>
3337
+
3324
3338
  <xsl:apply-templates/>
3325
3339
  </fo:block>
3326
3340
  </fo:table-cell>
@@ -3556,7 +3570,11 @@
3556
3570
  <xsl:apply-templates/>
3557
3571
  </fo:inline>
3558
3572
  </xsl:template><xsl:template match="*[local-name()='dl']">
3559
- <fo:block-container margin-left="0mm">
3573
+ <fo:block-container>
3574
+
3575
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3576
+
3577
+
3560
3578
  <xsl:if test="parent::*[local-name() = 'note']">
3561
3579
  <xsl:attribute name="margin-left">
3562
3580
  <xsl:choose>
@@ -3566,8 +3584,11 @@
3566
3584
  </xsl:attribute>
3567
3585
 
3568
3586
  </xsl:if>
3569
- <fo:block-container margin-left="0mm">
3570
-
3587
+ <fo:block-container>
3588
+
3589
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3590
+
3591
+
3571
3592
  <xsl:variable name="parent" select="local-name(..)"/>
3572
3593
 
3573
3594
  <xsl:variable name="key_iso">
@@ -3585,9 +3606,12 @@
3585
3606
 
3586
3607
 
3587
3608
  <xsl:variable name="title-where">
3588
- <xsl:call-template name="getTitle">
3589
- <xsl:with-param name="name" select="'title-where'"/>
3590
- </xsl:call-template>
3609
+
3610
+
3611
+ <xsl:call-template name="getTitle">
3612
+ <xsl:with-param name="name" select="'title-where'"/>
3613
+ </xsl:call-template>
3614
+
3591
3615
  </xsl:variable>
3592
3616
  <xsl:value-of select="$title-where"/>
3593
3617
  </fo:block>
@@ -3610,9 +3634,12 @@
3610
3634
 
3611
3635
 
3612
3636
  <xsl:variable name="title-where">
3613
- <xsl:call-template name="getTitle">
3614
- <xsl:with-param name="name" select="'title-where'"/>
3615
- </xsl:call-template>
3637
+
3638
+
3639
+ <xsl:call-template name="getTitle">
3640
+ <xsl:with-param name="name" select="'title-where'"/>
3641
+ </xsl:call-template>
3642
+
3616
3643
  </xsl:variable>
3617
3644
  <xsl:value-of select="$title-where"/>
3618
3645
  </fo:block>
@@ -3626,9 +3653,12 @@
3626
3653
 
3627
3654
 
3628
3655
  <xsl:variable name="title-key">
3629
- <xsl:call-template name="getTitle">
3630
- <xsl:with-param name="name" select="'title-key'"/>
3631
- </xsl:call-template>
3656
+
3657
+
3658
+ <xsl:call-template name="getTitle">
3659
+ <xsl:with-param name="name" select="'title-key'"/>
3660
+ </xsl:call-template>
3661
+
3632
3662
  </xsl:variable>
3633
3663
  <xsl:value-of select="$title-key"/>
3634
3664
  </fo:block>
@@ -4205,7 +4235,18 @@
4205
4235
  <xsl:with-param name="previousRow" select="$newRow"/>
4206
4236
  </xsl:apply-templates>
4207
4237
  </xsl:template><xsl:template name="getLang">
4208
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4238
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4239
+ <xsl:variable name="language">
4240
+ <xsl:choose>
4241
+ <xsl:when test="$language_current != ''">
4242
+ <xsl:value-of select="$language_current"/>
4243
+ </xsl:when>
4244
+ <xsl:otherwise>
4245
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4246
+ </xsl:otherwise>
4247
+ </xsl:choose>
4248
+ </xsl:variable>
4249
+
4209
4250
  <xsl:choose>
4210
4251
  <xsl:when test="$language = 'English'">en</xsl:when>
4211
4252
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -4240,6 +4281,7 @@
4240
4281
  <xsl:value-of select="substring($str, 2)"/>
4241
4282
  </xsl:template><xsl:template match="mathml:math">
4242
4283
  <fo:inline font-family="STIX Two Math"> <!-- -->
4284
+
4243
4285
  <xsl:variable name="mathml">
4244
4286
  <xsl:apply-templates select="." mode="mathml"/>
4245
4287
  </xsl:variable>
@@ -4322,10 +4364,14 @@
4322
4364
  </fo:inline>
4323
4365
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
4324
4366
  <xsl:variable name="title-modified">
4325
- <xsl:call-template name="getTitle">
4326
- <xsl:with-param name="name" select="'title-modified'"/>
4327
- </xsl:call-template>
4367
+
4368
+
4369
+ <xsl:call-template name="getTitle">
4370
+ <xsl:with-param name="name" select="'title-modified'"/>
4371
+ </xsl:call-template>
4372
+
4328
4373
  </xsl:variable>
4374
+
4329
4375
  <xsl:choose>
4330
4376
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4331
4377
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -5079,9 +5125,14 @@
5079
5125
 
5080
5126
  <fo:inline>
5081
5127
 
5082
- <xsl:call-template name="getTitle">
5083
- <xsl:with-param name="name" select="'title-source'"/>
5084
- </xsl:call-template>
5128
+
5129
+
5130
+
5131
+ <xsl:call-template name="getTitle">
5132
+ <xsl:with-param name="name" select="'title-source'"/>
5133
+ </xsl:call-template>
5134
+
5135
+
5085
5136
  <xsl:text>: </xsl:text>
5086
5137
  </fo:inline>
5087
5138
 
@@ -5232,9 +5283,12 @@
5232
5283
  </fo:block>
5233
5284
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
5234
5285
  <xsl:variable name="title-deprecated">
5235
- <xsl:call-template name="getTitle">
5236
- <xsl:with-param name="name" select="'title-deprecated'"/>
5237
- </xsl:call-template>
5286
+
5287
+
5288
+ <xsl:call-template name="getTitle">
5289
+ <xsl:with-param name="name" select="'title-deprecated'"/>
5290
+ </xsl:call-template>
5291
+
5238
5292
  </xsl:variable>
5239
5293
  <fo:block xsl:use-attribute-sets="deprecates-style">
5240
5294
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -5595,13 +5649,22 @@
5595
5649
  </xsl:template><xsl:template name="split">
5596
5650
  <xsl:param name="pText" select="."/>
5597
5651
  <xsl:param name="sep" select="','"/>
5652
+ <xsl:param name="normalize-space" select="'true'"/>
5598
5653
  <xsl:if test="string-length($pText) &gt;0">
5599
5654
  <item>
5600
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
5655
+ <xsl:choose>
5656
+ <xsl:when test="$normalize-space = 'true'">
5657
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
5658
+ </xsl:when>
5659
+ <xsl:otherwise>
5660
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
5661
+ </xsl:otherwise>
5662
+ </xsl:choose>
5601
5663
  </item>
5602
5664
  <xsl:call-template name="split">
5603
5665
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
5604
5666
  <xsl:with-param name="sep" select="$sep"/>
5667
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
5605
5668
  </xsl:call-template>
5606
5669
  </xsl:if>
5607
5670
  </xsl:template><xsl:template name="getDocumentId">
@@ -5667,4 +5730,23 @@
5667
5730
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
5668
5731
  </xsl:call-template>
5669
5732
  </xsl:if>
5733
+ </xsl:template><xsl:template name="repeat">
5734
+ <xsl:param name="char" select="'*'"/>
5735
+ <xsl:param name="count"/>
5736
+ <xsl:if test="$count &gt; 0">
5737
+ <xsl:value-of select="$char"/>
5738
+ <xsl:call-template name="repeat">
5739
+ <xsl:with-param name="char" select="$char"/>
5740
+ <xsl:with-param name="count" select="$count - 1"/>
5741
+ </xsl:call-template>
5742
+ </xsl:if>
5743
+ </xsl:template><xsl:template name="getLocalizedString">
5744
+ <xsl:param name="key"/>
5745
+
5746
+ <xsl:variable name="curr_lang">
5747
+ <xsl:call-template name="getLang"/>
5748
+ </xsl:variable>
5749
+
5750
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5751
+
5670
5752
  </xsl:template></xsl:stylesheet>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "1.2.7"
3
+ VERSION = "1.2.8"
4
4
  end
5
5
  end
6
6
 
@@ -266,65 +266,6 @@ RSpec.describe Asciidoctor::Iec do
266
266
  OUTPUT
267
267
  end
268
268
 
269
- it "moves table key inside table" do
270
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
271
- #{ASCIIDOC_BLANK_HDR}
272
- |===
273
- |a |b |c
274
- |===
275
-
276
- Key
277
-
278
- a:: b
279
- INPUT
280
- #{BLANK_HDR}
281
- <sections><table id="_">
282
- <tbody>
283
- <tr>
284
- <td valign="top" align="left">a</td>
285
- <td valign="top" align="left">b</td>
286
- <td valign="top" align="left">c</td>
287
- </tr>
288
- </tbody>
289
- <dl id="_">
290
- <dt>a</dt>
291
- <dd>
292
- <p id="_">b</p>
293
- </dd>
294
- </dl></table>
295
-
296
- </sections>
297
- </iec-standard>
298
- OUTPUT
299
- end
300
-
301
- it "moves formula key inside formula" do
302
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
303
- #{ASCIIDOC_BLANK_HDR}
304
- [stem]
305
- ++++
306
- Formula
307
- ++++
308
-
309
- where
310
-
311
- a:: b
312
- INPUT
313
- #{BLANK_HDR}
314
- <sections><formula id="_">
315
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mi>or</mi><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
316
- <dl id="_">
317
- <dt>a</dt>
318
- <dd>
319
- <p id="_">b</p>
320
- </dd>
321
- </dl></formula>
322
-
323
- </sections>
324
- </iec-standard>
325
- OUTPUT
326
- end
327
-
328
269
  it "moves footnotes inside figures" do
329
270
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
330
271
  #{ASCIIDOC_BLANK_HDR}
@@ -349,31 +290,6 @@ RSpec.describe Asciidoctor::Iec do
349
290
  OUTPUT
350
291
  end
351
292
 
352
- it "moves figure key inside figure" do
353
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
354
- #{ASCIIDOC_BLANK_HDR}
355
- image::spec/examples/rice_images/rice_image1.png[]
356
-
357
- Key
358
-
359
- a:: b
360
- INPUT
361
- #{BLANK_HDR}
362
- <sections><figure id="_">
363
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
364
- <dl id="_">
365
- <dt>a</dt>
366
- <dd>
367
- <p id="_">b</p>
368
- </dd>
369
- </dl></figure>
370
-
371
- </sections>
372
-
373
- </iec-standard>
374
- OUTPUT
375
- end
376
-
377
293
  it "defaults section obligations" do
378
294
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
379
295
  #{ASCIIDOC_BLANK_HDR}
@@ -44,7 +44,7 @@ RSpec.describe IsoDoc::Iec do
44
44
  <abbreviation>ISO</abbreviation>
45
45
  </organization>
46
46
  </contributor>
47
- <note format="text/plain" reference="1" type="ISO DATE">Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
47
+ <note format="text/plain" reference="1" type="Unpublished-Status">Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
48
48
  <extent type="part">
49
49
  <referenceFrom>all</referenceFrom>
50
50
  </extent>
@@ -167,7 +167,7 @@ RSpec.describe IsoDoc::Iec do
167
167
  <abbreviation>ISO</abbreviation>
168
168
  </organization>
169
169
  </contributor>
170
- <note format="text/plain" reference="1" type="ISO DATE">Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
170
+ <note format="text/plain" reference="1" type="Unpublished-Status">Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
171
171
  <extent type="part">
172
172
  <referenceFrom>all</referenceFrom>
173
173
  </extent>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-25 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing