metanorma-un 0.5.6 → 0.5.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79714156551c88f6bc3eefeebdbeffe4193e8dbd1733c37daafe177a86eacea0
4
- data.tar.gz: 5840e63035de8487fc98ef7b666b25f30aaaf3176e0d2b117f9b2e8d4797eda1
3
+ metadata.gz: c01dbd7826220e4745047a2e35efb4c1a84652261f3885f867a59c76689afaba
4
+ data.tar.gz: b92a663a7cfbd929b559fa8066f6c5b09737e85d8ddfb39a804fa51dfa03ddb8
5
5
  SHA512:
6
- metadata.gz: 894f12d8ecf83d3d6b6550e034bcc14412788df9c1f094457ff09590e133385ccb424c7ed3d7048edb82a5cd162f63ccae0cdcb82bf80783e108d529ab5ad882
7
- data.tar.gz: c80957880910920416881f277c72b7990cc50cda1b7bbccda5457916a6ec8b8d175dc5a7c1138c9c662acca0aac23ca08151ec2f117a9cb30f90a8b3385100c7
6
+ metadata.gz: 47b69cccf5f4f6b0415da7117820238a19e54760598e693e029095360a85fd68f6bccc6b9a3a3e5286a4c166c647a469e17118a98f41332add49e84bd2d687f9
7
+ data.tar.gz: f5b1c1ab84c63061e38a7134af4daf3e08a5d372c5a528f10915e6790dd417a3739089f5ee20116991ff36903f153d30aedc83b258ce3f509b6f60ba662da595
@@ -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 }}
@@ -3,16 +3,14 @@
3
3
  (Formerly known as metanorma-unece)
4
4
 
5
5
  image:https://img.shields.io/gem/v/metanorma-un.svg["Gem Version", link="https://rubygems.org/gems/metanorma-un"]::
6
- image:https://github.com/metanorma/metanorma-un/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-un/actions?workflow=macos"]
7
- image:https://github.com/metanorma/metanorma-un/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-un/actions?workflow=windows"]
8
- image:https://github.com/metanorma/metanorma-un/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/metanorma/metanorma-un/actions?workflow=ubuntu"]
6
+ image:https://github.com/metanorma/metanorma-un/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-un/actions?workflow=rake"]
9
7
  image:https://codeclimate.com/github/metanorma/metanorma-unece/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-unece"]
10
8
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-un.svg["Pull Requests", link="https://github.com/metanorma/metanorma-un/pulls"]
11
9
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-un/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-un/releases"]
12
10
 
13
11
  == Functionality
14
12
 
15
- This gem processes http://asciidoctor.org/[Asciidoctor] documents following
13
+ This gem processes https://www.metanorma.com/[Metanorma documents] following
16
14
  a template for generating UN International Standards.
17
15
 
18
16
  The gem currently inherits from the https://github.com/metanorma/metanorma-standoc[Metanorma-Standoc]
@@ -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"/>
@@ -1,2 +1,3 @@
1
1
  admonition: Box
2
2
  abstract: Summary
3
+ paragraph: paragraph
@@ -162,7 +162,40 @@
162
162
  <fo:block margin-left="-20mm">
163
163
  <fo:block font-size="17pt" margin-bottom="16pt">
164
164
  <xsl:value-of select="$title"/>
165
+
166
+ <xsl:for-each select="/un:un-standard/un:bibdata/un:note[@type = 'title-footnote']">
167
+ <xsl:variable name="number" select="position()"/>
168
+ <fo:inline font-size="14pt" baseline-shift="15%" font-weight="normal">
169
+ <xsl:if test="$number = 1">
170
+ <xsl:text> </xsl:text>
171
+ </xsl:if>
172
+ <fo:basic-link internal-destination="title-footnote_{$number}" fox:alt-text="title footnote">
173
+ <xsl:call-template name="repeat">
174
+ <xsl:with-param name="char" select="'*'"/>
175
+ <xsl:with-param name="count" select="$number"/>
176
+ </xsl:call-template>
177
+ </fo:basic-link>
178
+ <xsl:if test="position() != last()"><fo:inline baseline-shift="20%">,</fo:inline></xsl:if>
179
+ </fo:inline>
180
+ </xsl:for-each>
181
+
182
+ <xsl:for-each select="/un:un-standard/un:bibdata/un:note[@type = 'title-footnote']">
183
+ <xsl:variable name="number" select="position()"/>
184
+ <fo:block id="title-footnote_{$number}" font-size="14pt" font-weight="normal">
185
+ <xsl:if test="$number = 1">
186
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
187
+ </xsl:if>
188
+ <xsl:call-template name="repeat">
189
+ <xsl:with-param name="char" select="'*'"/>
190
+ <xsl:with-param name="count" select="$number"/>
191
+ </xsl:call-template>
192
+ <xsl:text> </xsl:text>
193
+ <xsl:apply-templates/>
194
+ </fo:block>
195
+ </xsl:for-each>
196
+
165
197
  </fo:block>
198
+
166
199
  <fo:block font-size="14pt" margin-bottom="16pt">
167
200
  <xsl:value-of select="/un:un-standard/un:bibdata/un:title[@language = 'en' and @type = 'subtitle']"/>
168
201
  </fo:block>
@@ -1214,13 +1247,22 @@
1214
1247
  <title-part lang="en">
1215
1248
 
1216
1249
 
1250
+
1217
1251
  </title-part>
1218
1252
  <title-part lang="fr">
1219
1253
 
1220
1254
 
1255
+
1221
1256
  </title-part>
1222
1257
  <title-part lang="zh">第 # 部分:</title-part>
1223
1258
 
1259
+ <title-subpart lang="en">
1260
+
1261
+ </title-subpart>
1262
+ <title-subpart lang="fr">
1263
+
1264
+ </title-subpart>
1265
+
1224
1266
  <title-modified lang="en">modified</title-modified>
1225
1267
  <title-modified lang="fr">modifiée</title-modified>
1226
1268
 
@@ -1663,7 +1705,9 @@
1663
1705
 
1664
1706
 
1665
1707
 
1666
-
1708
+ <!-- <xsl:if test="$namespace = 'bipm'">
1709
+ <fo:block>&#xA0;</fo:block>
1710
+ </xsl:if> -->
1667
1711
 
1668
1712
  <!-- $namespace = 'iso' or -->
1669
1713
 
@@ -1831,6 +1875,7 @@
1831
1875
  <xsl:if test="normalize-space() != ''">
1832
1876
  <fo:block xsl:use-attribute-sets="table-name-style">
1833
1877
 
1878
+
1834
1879
  <xsl:apply-templates/>
1835
1880
  </fo:block>
1836
1881
  </xsl:if>
@@ -2188,6 +2233,7 @@
2188
2233
  </xsl:if>
2189
2234
 
2190
2235
 
2236
+
2191
2237
  <!-- <xsl:if test="$namespace = 'bipm'">
2192
2238
  <xsl:attribute name="height">8mm</xsl:attribute>
2193
2239
  </xsl:if> -->
@@ -2291,7 +2337,8 @@
2291
2337
  </xsl:attribute>
2292
2338
  </xsl:if>
2293
2339
  <xsl:call-template name="display-align"/>
2294
- <fo:block>
2340
+ <fo:block>
2341
+
2295
2342
  <xsl:apply-templates/>
2296
2343
  </fo:block>
2297
2344
  </fo:table-cell>
@@ -2513,7 +2560,11 @@
2513
2560
  <xsl:apply-templates/>
2514
2561
  </fo:inline>
2515
2562
  </xsl:template><xsl:template match="*[local-name()='dl']">
2516
- <fo:block-container margin-left="0mm">
2563
+ <fo:block-container>
2564
+
2565
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2566
+
2567
+
2517
2568
  <xsl:if test="parent::*[local-name() = 'note']">
2518
2569
  <xsl:attribute name="margin-left">
2519
2570
  <xsl:choose>
@@ -2523,8 +2574,11 @@
2523
2574
  </xsl:attribute>
2524
2575
 
2525
2576
  </xsl:if>
2526
- <fo:block-container margin-left="0mm">
2527
-
2577
+ <fo:block-container>
2578
+
2579
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2580
+
2581
+
2528
2582
  <xsl:variable name="parent" select="local-name(..)"/>
2529
2583
 
2530
2584
  <xsl:variable name="key_iso">
@@ -2538,9 +2592,12 @@
2538
2592
  <fo:block margin-bottom="12pt" text-align="left">
2539
2593
 
2540
2594
  <xsl:variable name="title-where">
2541
- <xsl:call-template name="getTitle">
2542
- <xsl:with-param name="name" select="'title-where'"/>
2543
- </xsl:call-template>
2595
+
2596
+
2597
+ <xsl:call-template name="getTitle">
2598
+ <xsl:with-param name="name" select="'title-where'"/>
2599
+ </xsl:call-template>
2600
+
2544
2601
  </xsl:variable>
2545
2602
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2546
2603
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2556,9 +2613,12 @@
2556
2613
 
2557
2614
 
2558
2615
  <xsl:variable name="title-where">
2559
- <xsl:call-template name="getTitle">
2560
- <xsl:with-param name="name" select="'title-where'"/>
2561
- </xsl:call-template>
2616
+
2617
+
2618
+ <xsl:call-template name="getTitle">
2619
+ <xsl:with-param name="name" select="'title-where'"/>
2620
+ </xsl:call-template>
2621
+
2562
2622
  </xsl:variable>
2563
2623
  <xsl:value-of select="$title-where"/>
2564
2624
  </fo:block>
@@ -2569,9 +2629,12 @@
2569
2629
 
2570
2630
 
2571
2631
  <xsl:variable name="title-key">
2572
- <xsl:call-template name="getTitle">
2573
- <xsl:with-param name="name" select="'title-key'"/>
2574
- </xsl:call-template>
2632
+
2633
+
2634
+ <xsl:call-template name="getTitle">
2635
+ <xsl:with-param name="name" select="'title-key'"/>
2636
+ </xsl:call-template>
2637
+
2575
2638
  </xsl:variable>
2576
2639
  <xsl:value-of select="$title-key"/>
2577
2640
  </fo:block>
@@ -3142,7 +3205,18 @@
3142
3205
  <xsl:with-param name="previousRow" select="$newRow"/>
3143
3206
  </xsl:apply-templates>
3144
3207
  </xsl:template><xsl:template name="getLang">
3145
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3208
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3209
+ <xsl:variable name="language">
3210
+ <xsl:choose>
3211
+ <xsl:when test="$language_current != ''">
3212
+ <xsl:value-of select="$language_current"/>
3213
+ </xsl:when>
3214
+ <xsl:otherwise>
3215
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3216
+ </xsl:otherwise>
3217
+ </xsl:choose>
3218
+ </xsl:variable>
3219
+
3146
3220
  <xsl:choose>
3147
3221
  <xsl:when test="$language = 'English'">en</xsl:when>
3148
3222
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -3177,6 +3251,7 @@
3177
3251
  <xsl:value-of select="substring($str, 2)"/>
3178
3252
  </xsl:template><xsl:template match="mathml:math">
3179
3253
  <fo:inline font-family="STIX Two Math"> <!-- -->
3254
+
3180
3255
  <xsl:variable name="mathml">
3181
3256
  <xsl:apply-templates select="." mode="mathml"/>
3182
3257
  </xsl:variable>
@@ -3259,10 +3334,14 @@
3259
3334
  </fo:inline>
3260
3335
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
3261
3336
  <xsl:variable name="title-modified">
3262
- <xsl:call-template name="getTitle">
3263
- <xsl:with-param name="name" select="'title-modified'"/>
3264
- </xsl:call-template>
3337
+
3338
+
3339
+ <xsl:call-template name="getTitle">
3340
+ <xsl:with-param name="name" select="'title-modified'"/>
3341
+ </xsl:call-template>
3342
+
3265
3343
  </xsl:variable>
3344
+
3266
3345
  <xsl:choose>
3267
3346
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3268
3347
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -4150,9 +4229,12 @@
4150
4229
  </fo:block>
4151
4230
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
4152
4231
  <xsl:variable name="title-deprecated">
4153
- <xsl:call-template name="getTitle">
4154
- <xsl:with-param name="name" select="'title-deprecated'"/>
4155
- </xsl:call-template>
4232
+
4233
+
4234
+ <xsl:call-template name="getTitle">
4235
+ <xsl:with-param name="name" select="'title-deprecated'"/>
4236
+ </xsl:call-template>
4237
+
4156
4238
  </xsl:variable>
4157
4239
  <fo:block xsl:use-attribute-sets="deprecates-style">
4158
4240
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4523,13 +4605,22 @@
4523
4605
  </xsl:template><xsl:template name="split">
4524
4606
  <xsl:param name="pText" select="."/>
4525
4607
  <xsl:param name="sep" select="','"/>
4608
+ <xsl:param name="normalize-space" select="'true'"/>
4526
4609
  <xsl:if test="string-length($pText) &gt;0">
4527
4610
  <item>
4528
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4611
+ <xsl:choose>
4612
+ <xsl:when test="$normalize-space = 'true'">
4613
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4614
+ </xsl:when>
4615
+ <xsl:otherwise>
4616
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4617
+ </xsl:otherwise>
4618
+ </xsl:choose>
4529
4619
  </item>
4530
4620
  <xsl:call-template name="split">
4531
4621
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4532
4622
  <xsl:with-param name="sep" select="$sep"/>
4623
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4533
4624
  </xsl:call-template>
4534
4625
  </xsl:if>
4535
4626
  </xsl:template><xsl:template name="getDocumentId">
@@ -4595,4 +4686,23 @@
4595
4686
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4596
4687
  </xsl:call-template>
4597
4688
  </xsl:if>
4689
+ </xsl:template><xsl:template name="repeat">
4690
+ <xsl:param name="char" select="'*'"/>
4691
+ <xsl:param name="count"/>
4692
+ <xsl:if test="$count &gt; 0">
4693
+ <xsl:value-of select="$char"/>
4694
+ <xsl:call-template name="repeat">
4695
+ <xsl:with-param name="char" select="$char"/>
4696
+ <xsl:with-param name="count" select="$count - 1"/>
4697
+ </xsl:call-template>
4698
+ </xsl:if>
4699
+ </xsl:template><xsl:template name="getLocalizedString">
4700
+ <xsl:param name="key"/>
4701
+
4702
+ <xsl:variable name="curr_lang">
4703
+ <xsl:call-template name="getLang"/>
4704
+ </xsl:variable>
4705
+
4706
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4707
+
4598
4708
  </xsl:template></xsl:stylesheet>
@@ -162,7 +162,40 @@
162
162
  <fo:block margin-left="-20mm">
163
163
  <fo:block font-size="17pt" margin-bottom="16pt">
164
164
  <xsl:value-of select="$title"/>
165
+
166
+ <xsl:for-each select="/un:un-standard/un:bibdata/un:note[@type = 'title-footnote']">
167
+ <xsl:variable name="number" select="position()"/>
168
+ <fo:inline font-size="14pt" baseline-shift="15%" font-weight="normal">
169
+ <xsl:if test="$number = 1">
170
+ <xsl:text> </xsl:text>
171
+ </xsl:if>
172
+ <fo:basic-link internal-destination="title-footnote_{$number}" fox:alt-text="title footnote">
173
+ <xsl:call-template name="repeat">
174
+ <xsl:with-param name="char" select="'*'"/>
175
+ <xsl:with-param name="count" select="$number"/>
176
+ </xsl:call-template>
177
+ </fo:basic-link>
178
+ <xsl:if test="position() != last()"><fo:inline baseline-shift="20%">,</fo:inline></xsl:if>
179
+ </fo:inline>
180
+ </xsl:for-each>
181
+
182
+ <xsl:for-each select="/un:un-standard/un:bibdata/un:note[@type = 'title-footnote']">
183
+ <xsl:variable name="number" select="position()"/>
184
+ <fo:block id="title-footnote_{$number}" font-size="14pt" font-weight="normal">
185
+ <xsl:if test="$number = 1">
186
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
187
+ </xsl:if>
188
+ <xsl:call-template name="repeat">
189
+ <xsl:with-param name="char" select="'*'"/>
190
+ <xsl:with-param name="count" select="$number"/>
191
+ </xsl:call-template>
192
+ <xsl:text> </xsl:text>
193
+ <xsl:apply-templates/>
194
+ </fo:block>
195
+ </xsl:for-each>
196
+
165
197
  </fo:block>
198
+
166
199
  <fo:block font-size="14pt" margin-bottom="16pt">
167
200
  <xsl:value-of select="/un:un-standard/un:bibdata/un:title[@language = 'en' and @type = 'subtitle']"/>
168
201
  </fo:block>
@@ -1214,13 +1247,22 @@
1214
1247
  <title-part lang="en">
1215
1248
 
1216
1249
 
1250
+
1217
1251
  </title-part>
1218
1252
  <title-part lang="fr">
1219
1253
 
1220
1254
 
1255
+
1221
1256
  </title-part>
1222
1257
  <title-part lang="zh">第 # 部分:</title-part>
1223
1258
 
1259
+ <title-subpart lang="en">
1260
+
1261
+ </title-subpart>
1262
+ <title-subpart lang="fr">
1263
+
1264
+ </title-subpart>
1265
+
1224
1266
  <title-modified lang="en">modified</title-modified>
1225
1267
  <title-modified lang="fr">modifiée</title-modified>
1226
1268
 
@@ -1663,7 +1705,9 @@
1663
1705
 
1664
1706
 
1665
1707
 
1666
-
1708
+ <!-- <xsl:if test="$namespace = 'bipm'">
1709
+ <fo:block>&#xA0;</fo:block>
1710
+ </xsl:if> -->
1667
1711
 
1668
1712
  <!-- $namespace = 'iso' or -->
1669
1713
 
@@ -1831,6 +1875,7 @@
1831
1875
  <xsl:if test="normalize-space() != ''">
1832
1876
  <fo:block xsl:use-attribute-sets="table-name-style">
1833
1877
 
1878
+
1834
1879
  <xsl:apply-templates/>
1835
1880
  </fo:block>
1836
1881
  </xsl:if>
@@ -2188,6 +2233,7 @@
2188
2233
  </xsl:if>
2189
2234
 
2190
2235
 
2236
+
2191
2237
  <!-- <xsl:if test="$namespace = 'bipm'">
2192
2238
  <xsl:attribute name="height">8mm</xsl:attribute>
2193
2239
  </xsl:if> -->
@@ -2291,7 +2337,8 @@
2291
2337
  </xsl:attribute>
2292
2338
  </xsl:if>
2293
2339
  <xsl:call-template name="display-align"/>
2294
- <fo:block>
2340
+ <fo:block>
2341
+
2295
2342
  <xsl:apply-templates/>
2296
2343
  </fo:block>
2297
2344
  </fo:table-cell>
@@ -2513,7 +2560,11 @@
2513
2560
  <xsl:apply-templates/>
2514
2561
  </fo:inline>
2515
2562
  </xsl:template><xsl:template match="*[local-name()='dl']">
2516
- <fo:block-container margin-left="0mm">
2563
+ <fo:block-container>
2564
+
2565
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2566
+
2567
+
2517
2568
  <xsl:if test="parent::*[local-name() = 'note']">
2518
2569
  <xsl:attribute name="margin-left">
2519
2570
  <xsl:choose>
@@ -2523,8 +2574,11 @@
2523
2574
  </xsl:attribute>
2524
2575
 
2525
2576
  </xsl:if>
2526
- <fo:block-container margin-left="0mm">
2527
-
2577
+ <fo:block-container>
2578
+
2579
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2580
+
2581
+
2528
2582
  <xsl:variable name="parent" select="local-name(..)"/>
2529
2583
 
2530
2584
  <xsl:variable name="key_iso">
@@ -2538,9 +2592,12 @@
2538
2592
  <fo:block margin-bottom="12pt" text-align="left">
2539
2593
 
2540
2594
  <xsl:variable name="title-where">
2541
- <xsl:call-template name="getTitle">
2542
- <xsl:with-param name="name" select="'title-where'"/>
2543
- </xsl:call-template>
2595
+
2596
+
2597
+ <xsl:call-template name="getTitle">
2598
+ <xsl:with-param name="name" select="'title-where'"/>
2599
+ </xsl:call-template>
2600
+
2544
2601
  </xsl:variable>
2545
2602
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2546
2603
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2556,9 +2613,12 @@
2556
2613
 
2557
2614
 
2558
2615
  <xsl:variable name="title-where">
2559
- <xsl:call-template name="getTitle">
2560
- <xsl:with-param name="name" select="'title-where'"/>
2561
- </xsl:call-template>
2616
+
2617
+
2618
+ <xsl:call-template name="getTitle">
2619
+ <xsl:with-param name="name" select="'title-where'"/>
2620
+ </xsl:call-template>
2621
+
2562
2622
  </xsl:variable>
2563
2623
  <xsl:value-of select="$title-where"/>
2564
2624
  </fo:block>
@@ -2569,9 +2629,12 @@
2569
2629
 
2570
2630
 
2571
2631
  <xsl:variable name="title-key">
2572
- <xsl:call-template name="getTitle">
2573
- <xsl:with-param name="name" select="'title-key'"/>
2574
- </xsl:call-template>
2632
+
2633
+
2634
+ <xsl:call-template name="getTitle">
2635
+ <xsl:with-param name="name" select="'title-key'"/>
2636
+ </xsl:call-template>
2637
+
2575
2638
  </xsl:variable>
2576
2639
  <xsl:value-of select="$title-key"/>
2577
2640
  </fo:block>
@@ -3142,7 +3205,18 @@
3142
3205
  <xsl:with-param name="previousRow" select="$newRow"/>
3143
3206
  </xsl:apply-templates>
3144
3207
  </xsl:template><xsl:template name="getLang">
3145
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3208
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3209
+ <xsl:variable name="language">
3210
+ <xsl:choose>
3211
+ <xsl:when test="$language_current != ''">
3212
+ <xsl:value-of select="$language_current"/>
3213
+ </xsl:when>
3214
+ <xsl:otherwise>
3215
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3216
+ </xsl:otherwise>
3217
+ </xsl:choose>
3218
+ </xsl:variable>
3219
+
3146
3220
  <xsl:choose>
3147
3221
  <xsl:when test="$language = 'English'">en</xsl:when>
3148
3222
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -3177,6 +3251,7 @@
3177
3251
  <xsl:value-of select="substring($str, 2)"/>
3178
3252
  </xsl:template><xsl:template match="mathml:math">
3179
3253
  <fo:inline font-family="STIX Two Math"> <!-- -->
3254
+
3180
3255
  <xsl:variable name="mathml">
3181
3256
  <xsl:apply-templates select="." mode="mathml"/>
3182
3257
  </xsl:variable>
@@ -3259,10 +3334,14 @@
3259
3334
  </fo:inline>
3260
3335
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
3261
3336
  <xsl:variable name="title-modified">
3262
- <xsl:call-template name="getTitle">
3263
- <xsl:with-param name="name" select="'title-modified'"/>
3264
- </xsl:call-template>
3337
+
3338
+
3339
+ <xsl:call-template name="getTitle">
3340
+ <xsl:with-param name="name" select="'title-modified'"/>
3341
+ </xsl:call-template>
3342
+
3265
3343
  </xsl:variable>
3344
+
3266
3345
  <xsl:choose>
3267
3346
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3268
3347
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -4150,9 +4229,12 @@
4150
4229
  </fo:block>
4151
4230
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
4152
4231
  <xsl:variable name="title-deprecated">
4153
- <xsl:call-template name="getTitle">
4154
- <xsl:with-param name="name" select="'title-deprecated'"/>
4155
- </xsl:call-template>
4232
+
4233
+
4234
+ <xsl:call-template name="getTitle">
4235
+ <xsl:with-param name="name" select="'title-deprecated'"/>
4236
+ </xsl:call-template>
4237
+
4156
4238
  </xsl:variable>
4157
4239
  <fo:block xsl:use-attribute-sets="deprecates-style">
4158
4240
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4523,13 +4605,22 @@
4523
4605
  </xsl:template><xsl:template name="split">
4524
4606
  <xsl:param name="pText" select="."/>
4525
4607
  <xsl:param name="sep" select="','"/>
4608
+ <xsl:param name="normalize-space" select="'true'"/>
4526
4609
  <xsl:if test="string-length($pText) &gt;0">
4527
4610
  <item>
4528
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4611
+ <xsl:choose>
4612
+ <xsl:when test="$normalize-space = 'true'">
4613
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4614
+ </xsl:when>
4615
+ <xsl:otherwise>
4616
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4617
+ </xsl:otherwise>
4618
+ </xsl:choose>
4529
4619
  </item>
4530
4620
  <xsl:call-template name="split">
4531
4621
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4532
4622
  <xsl:with-param name="sep" select="$sep"/>
4623
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4533
4624
  </xsl:call-template>
4534
4625
  </xsl:if>
4535
4626
  </xsl:template><xsl:template name="getDocumentId">
@@ -4595,4 +4686,23 @@
4595
4686
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4596
4687
  </xsl:call-template>
4597
4688
  </xsl:if>
4689
+ </xsl:template><xsl:template name="repeat">
4690
+ <xsl:param name="char" select="'*'"/>
4691
+ <xsl:param name="count"/>
4692
+ <xsl:if test="$count &gt; 0">
4693
+ <xsl:value-of select="$char"/>
4694
+ <xsl:call-template name="repeat">
4695
+ <xsl:with-param name="char" select="$char"/>
4696
+ <xsl:with-param name="count" select="$count - 1"/>
4697
+ </xsl:call-template>
4698
+ </xsl:if>
4699
+ </xsl:template><xsl:template name="getLocalizedString">
4700
+ <xsl:param name="key"/>
4701
+
4702
+ <xsl:variable name="curr_lang">
4703
+ <xsl:call-template name="getLang"/>
4704
+ </xsl:variable>
4705
+
4706
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4707
+
4598
4708
  </xsl:template></xsl:stylesheet>
@@ -1106,13 +1106,22 @@
1106
1106
  <title-part lang="en">
1107
1107
 
1108
1108
 
1109
+
1109
1110
  </title-part>
1110
1111
  <title-part lang="fr">
1111
1112
 
1112
1113
 
1114
+
1113
1115
  </title-part>
1114
1116
  <title-part lang="zh">第 # 部分:</title-part>
1115
1117
 
1118
+ <title-subpart lang="en">
1119
+
1120
+ </title-subpart>
1121
+ <title-subpart lang="fr">
1122
+
1123
+ </title-subpart>
1124
+
1116
1125
  <title-modified lang="en">modified</title-modified>
1117
1126
  <title-modified lang="fr">modifiée</title-modified>
1118
1127
 
@@ -1556,7 +1565,9 @@
1556
1565
 
1557
1566
 
1558
1567
 
1559
-
1568
+ <!-- <xsl:if test="$namespace = 'bipm'">
1569
+ <fo:block>&#xA0;</fo:block>
1570
+ </xsl:if> -->
1560
1571
 
1561
1572
  <!-- $namespace = 'iso' or -->
1562
1573
 
@@ -1729,6 +1740,7 @@
1729
1740
  <xsl:if test="normalize-space() != ''">
1730
1741
  <fo:block xsl:use-attribute-sets="table-name-style">
1731
1742
 
1743
+
1732
1744
  <xsl:apply-templates/>
1733
1745
  </fo:block>
1734
1746
  </xsl:if>
@@ -2082,6 +2094,7 @@
2082
2094
 
2083
2095
 
2084
2096
 
2097
+
2085
2098
  <!-- <xsl:if test="$namespace = 'bipm'">
2086
2099
  <xsl:attribute name="height">8mm</xsl:attribute>
2087
2100
  </xsl:if> -->
@@ -2189,7 +2202,8 @@
2189
2202
  </xsl:attribute>
2190
2203
  </xsl:if>
2191
2204
  <xsl:call-template name="display-align"/>
2192
- <fo:block>
2205
+ <fo:block>
2206
+
2193
2207
  <xsl:apply-templates/>
2194
2208
  </fo:block>
2195
2209
  </fo:table-cell>
@@ -2411,7 +2425,11 @@
2411
2425
  <xsl:apply-templates/>
2412
2426
  </fo:inline>
2413
2427
  </xsl:template><xsl:template match="*[local-name()='dl']">
2414
- <fo:block-container margin-left="0mm">
2428
+ <fo:block-container>
2429
+
2430
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2431
+
2432
+
2415
2433
  <xsl:if test="parent::*[local-name() = 'note']">
2416
2434
  <xsl:attribute name="margin-left">
2417
2435
  <xsl:choose>
@@ -2421,8 +2439,11 @@
2421
2439
  </xsl:attribute>
2422
2440
 
2423
2441
  </xsl:if>
2424
- <fo:block-container margin-left="0mm">
2425
-
2442
+ <fo:block-container>
2443
+
2444
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2445
+
2446
+
2426
2447
  <xsl:variable name="parent" select="local-name(..)"/>
2427
2448
 
2428
2449
  <xsl:variable name="key_iso">
@@ -2436,9 +2457,12 @@
2436
2457
  <fo:block margin-bottom="12pt" text-align="left">
2437
2458
 
2438
2459
  <xsl:variable name="title-where">
2439
- <xsl:call-template name="getTitle">
2440
- <xsl:with-param name="name" select="'title-where'"/>
2441
- </xsl:call-template>
2460
+
2461
+
2462
+ <xsl:call-template name="getTitle">
2463
+ <xsl:with-param name="name" select="'title-where'"/>
2464
+ </xsl:call-template>
2465
+
2442
2466
  </xsl:variable>
2443
2467
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2444
2468
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2454,9 +2478,12 @@
2454
2478
 
2455
2479
 
2456
2480
  <xsl:variable name="title-where">
2457
- <xsl:call-template name="getTitle">
2458
- <xsl:with-param name="name" select="'title-where'"/>
2459
- </xsl:call-template>
2481
+
2482
+
2483
+ <xsl:call-template name="getTitle">
2484
+ <xsl:with-param name="name" select="'title-where'"/>
2485
+ </xsl:call-template>
2486
+
2460
2487
  </xsl:variable>
2461
2488
  <xsl:value-of select="$title-where"/>
2462
2489
  </fo:block>
@@ -2467,9 +2494,12 @@
2467
2494
 
2468
2495
 
2469
2496
  <xsl:variable name="title-key">
2470
- <xsl:call-template name="getTitle">
2471
- <xsl:with-param name="name" select="'title-key'"/>
2472
- </xsl:call-template>
2497
+
2498
+
2499
+ <xsl:call-template name="getTitle">
2500
+ <xsl:with-param name="name" select="'title-key'"/>
2501
+ </xsl:call-template>
2502
+
2473
2503
  </xsl:variable>
2474
2504
  <xsl:value-of select="$title-key"/>
2475
2505
  </fo:block>
@@ -3040,7 +3070,18 @@
3040
3070
  <xsl:with-param name="previousRow" select="$newRow"/>
3041
3071
  </xsl:apply-templates>
3042
3072
  </xsl:template><xsl:template name="getLang">
3043
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3073
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3074
+ <xsl:variable name="language">
3075
+ <xsl:choose>
3076
+ <xsl:when test="$language_current != ''">
3077
+ <xsl:value-of select="$language_current"/>
3078
+ </xsl:when>
3079
+ <xsl:otherwise>
3080
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3081
+ </xsl:otherwise>
3082
+ </xsl:choose>
3083
+ </xsl:variable>
3084
+
3044
3085
  <xsl:choose>
3045
3086
  <xsl:when test="$language = 'English'">en</xsl:when>
3046
3087
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -3075,6 +3116,7 @@
3075
3116
  <xsl:value-of select="substring($str, 2)"/>
3076
3117
  </xsl:template><xsl:template match="mathml:math">
3077
3118
  <fo:inline font-family="STIX Two Math"> <!-- -->
3119
+
3078
3120
  <xsl:variable name="mathml">
3079
3121
  <xsl:apply-templates select="." mode="mathml"/>
3080
3122
  </xsl:variable>
@@ -3157,10 +3199,14 @@
3157
3199
  </fo:inline>
3158
3200
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
3159
3201
  <xsl:variable name="title-modified">
3160
- <xsl:call-template name="getTitle">
3161
- <xsl:with-param name="name" select="'title-modified'"/>
3162
- </xsl:call-template>
3202
+
3203
+
3204
+ <xsl:call-template name="getTitle">
3205
+ <xsl:with-param name="name" select="'title-modified'"/>
3206
+ </xsl:call-template>
3207
+
3163
3208
  </xsl:variable>
3209
+
3164
3210
  <xsl:choose>
3165
3211
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3166
3212
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -4055,9 +4101,12 @@
4055
4101
  </fo:block>
4056
4102
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
4057
4103
  <xsl:variable name="title-deprecated">
4058
- <xsl:call-template name="getTitle">
4059
- <xsl:with-param name="name" select="'title-deprecated'"/>
4060
- </xsl:call-template>
4104
+
4105
+
4106
+ <xsl:call-template name="getTitle">
4107
+ <xsl:with-param name="name" select="'title-deprecated'"/>
4108
+ </xsl:call-template>
4109
+
4061
4110
  </xsl:variable>
4062
4111
  <fo:block xsl:use-attribute-sets="deprecates-style">
4063
4112
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4430,13 +4479,22 @@
4430
4479
  </xsl:template><xsl:template name="split">
4431
4480
  <xsl:param name="pText" select="."/>
4432
4481
  <xsl:param name="sep" select="','"/>
4482
+ <xsl:param name="normalize-space" select="'true'"/>
4433
4483
  <xsl:if test="string-length($pText) &gt;0">
4434
4484
  <item>
4435
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4485
+ <xsl:choose>
4486
+ <xsl:when test="$normalize-space = 'true'">
4487
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4488
+ </xsl:when>
4489
+ <xsl:otherwise>
4490
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4491
+ </xsl:otherwise>
4492
+ </xsl:choose>
4436
4493
  </item>
4437
4494
  <xsl:call-template name="split">
4438
4495
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4439
4496
  <xsl:with-param name="sep" select="$sep"/>
4497
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4440
4498
  </xsl:call-template>
4441
4499
  </xsl:if>
4442
4500
  </xsl:template><xsl:template name="getDocumentId">
@@ -4502,4 +4560,23 @@
4502
4560
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4503
4561
  </xsl:call-template>
4504
4562
  </xsl:if>
4563
+ </xsl:template><xsl:template name="repeat">
4564
+ <xsl:param name="char" select="'*'"/>
4565
+ <xsl:param name="count"/>
4566
+ <xsl:if test="$count &gt; 0">
4567
+ <xsl:value-of select="$char"/>
4568
+ <xsl:call-template name="repeat">
4569
+ <xsl:with-param name="char" select="$char"/>
4570
+ <xsl:with-param name="count" select="$count - 1"/>
4571
+ </xsl:call-template>
4572
+ </xsl:if>
4573
+ </xsl:template><xsl:template name="getLocalizedString">
4574
+ <xsl:param name="key"/>
4575
+
4576
+ <xsl:variable name="curr_lang">
4577
+ <xsl:call-template name="getLang"/>
4578
+ </xsl:variable>
4579
+
4580
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4581
+
4505
4582
  </xsl:template></xsl:stylesheet>
@@ -56,14 +56,14 @@ module IsoDoc
56
56
  def label_leaf_section(clause, lvl)
57
57
  @paranumber += 1
58
58
  @anchors[clause["id"]] = {label: @paranumber.to_s,
59
- xref: "paragraph #{@paranumber}",
59
+ xref: l10n("#{@labels['paragraph']} #{@paranumber}"),
60
60
  level: lvl, type: "paragraph" }
61
61
  end
62
62
 
63
63
  def label_annex_leaf_section(clause, num, lvl)
64
64
  @paranumber += 1
65
65
  @anchors[clause["id"]] = {label: @paranumber.to_s,
66
- xref: "paragraph #{num}.#{@paranumber}",
66
+ xref: l10n("#{@labels['paragraph']} #{num}.#{@paranumber}"),
67
67
  level: lvl, type: "paragraph" }
68
68
  end
69
69
 
@@ -109,7 +109,7 @@ module IsoDoc
109
109
  label_annex_leaf_section(clause, num, 1) and return
110
110
  @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
111
111
  type: "clause", value: num,
112
- xref: "#{@labels['annex']} #{num}", level: 1 }
112
+ xref: l10n("#{@labels['annex']} #{num}"), level: 1 }
113
113
  if a = single_annex_special_section(clause)
114
114
  annex_names1(a, "#{num}", 1)
115
115
  else
@@ -126,7 +126,7 @@ module IsoDoc
126
126
  leaf_section?(clause) and
127
127
  label_annex_leaf_section(clause, num, level) and return
128
128
  /\.(?<leafnum>[^.]+$)/ =~ num
129
- @anchors[clause["id"]] = { label: leafnum, xref: "#{@labels['annex']} #{num}",
129
+ @anchors[clause["id"]] = { label: leafnum, xref: l10n("#{@labels['annex']} #{num}"),
130
130
  level: level, type: "clause" }
131
131
  i = 1
132
132
  clause.xpath(ns("./clause | ./references")).each do |c|
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.5.6"
3
+ VERSION = "0.5.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
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: roman-numerals